diff --git a/server/core_friend_test.go b/server/core_friend_test.go index 8a0d9ff00b..78fbaf47df 100644 --- a/server/core_friend_test.go +++ b/server/core_friend_test.go @@ -50,22 +50,50 @@ func TestServer_ListFriendsOfFriends(t *testing.T) { t.Fatal(err) } - addFriend(ctx, logger, tx, uid, uidA1.String()) - addFriend(ctx, logger, tx, uidA1, uid.String()) - addFriend(ctx, logger, tx, uidA1, uidA2.String()) - addFriend(ctx, logger, tx, uidA2, uidA1.String()) - addFriend(ctx, logger, tx, uidA1, uidA3.String()) - addFriend(ctx, logger, tx, uidA3, uidA1.String()) - - addFriend(ctx, logger, tx, uid, uidB1.String()) - addFriend(ctx, logger, tx, uidB1, uid.String()) - addFriend(ctx, logger, tx, uidB1, uidB2.String()) - addFriend(ctx, logger, tx, uidB2, uidB1.String()) - addFriend(ctx, logger, tx, uidB1, uidB3.String()) - addFriend(ctx, logger, tx, uidB3, uidB1.String()) - - addFriend(ctx, logger, tx, uid, uidB3.String()) - addFriend(ctx, logger, tx, uidB3, uid.String()) + if _, err := addFriend(ctx, logger, tx, uid, uidA1.String()); err != nil { + t.Fatal(err) + } + if _, err := addFriend(ctx, logger, tx, uidA1, uid.String()); err != nil { + t.Fatal(err) + } + if _, err := addFriend(ctx, logger, tx, uidA1, uidA2.String()); err != nil { + t.Fatal(err) + } + if _, err := addFriend(ctx, logger, tx, uidA2, uidA1.String()); err != nil { + t.Fatal(err) + } + if _, err := addFriend(ctx, logger, tx, uidA1, uidA3.String()); err != nil { + t.Fatal(err) + } + if _, err := addFriend(ctx, logger, tx, uidA3, uidA1.String()); err != nil { + t.Fatal(err) + } + + if _, err := addFriend(ctx, logger, tx, uid, uidB1.String()); err != nil { + t.Fatal(err) + } + if _, err := addFriend(ctx, logger, tx, uidB1, uid.String()); err != nil { + t.Fatal(err) + } + if _, err := addFriend(ctx, logger, tx, uidB1, uidB2.String()); err != nil { + t.Fatal(err) + } + if _, err := addFriend(ctx, logger, tx, uidB2, uidB1.String()); err != nil { + t.Fatal(err) + } + if _, err := addFriend(ctx, logger, tx, uidB1, uidB3.String()); err != nil { + t.Fatal(err) + } + if _, err := addFriend(ctx, logger, tx, uidB3, uidB1.String()); err != nil { + t.Fatal(err) + } + + if _, err := addFriend(ctx, logger, tx, uid, uidB3.String()); err != nil { + t.Fatal(err) + } + if _, err := addFriend(ctx, logger, tx, uidB3, uid.String()); err != nil { + t.Fatal(err) + } if err = tx.Commit(); err != nil { t.Fatal(err) diff --git a/server/matchmaker_test.go b/server/matchmaker_test.go index 82cc701272..2584a9a4ec 100644 --- a/server/matchmaker_test.go +++ b/server/matchmaker_test.go @@ -17,7 +17,6 @@ package server import ( "context" "errors" - "github.com/heroiclabs/nakama-common/api" "math" "os" "testing" @@ -25,6 +24,7 @@ import ( "github.com/blugelabs/bluge" "github.com/gofrs/uuid/v5" + "github.com/heroiclabs/nakama-common/api" "github.com/heroiclabs/nakama-common/rtapi" "github.com/heroiclabs/nakama-common/runtime" "github.com/stretchr/testify/assert" @@ -187,16 +187,16 @@ func TestMatchmakerPropertyRegexSubmatch(t *testing.T) { SessionIDs: map[string]struct{}{"sid1": {}}, }) if err != nil { - t.Fatalf(err.Error()) + t.Fatal(err) } if err := matchMaker.indexWriter.Update(bluge.Identifier("ticket1"), matchmakerIndexDoc1); err != nil { - t.Fatalf(err.Error()) + t.Fatal(err) } reader, err := matchMaker.indexWriter.Reader() if err != nil { - t.Fatalf(err.Error()) + t.Fatal(err) } defer reader.Close() diff --git a/server/runtime_lua_loadlib.go b/server/runtime_lua_loadlib.go index e3686c1662..c46851536d 100644 --- a/server/runtime_lua_loadlib.go +++ b/server/runtime_lua_loadlib.go @@ -61,7 +61,7 @@ func OpenPackage(moduleCache *RuntimeLuaModuleCache) func(L *lua.LState) int { } fn, err := L.Load(bytes.NewReader(module.Content), module.Path) if err != nil { - L.RaiseError(err.Error()) + L.RaiseError("error loading module: %v", err.Error()) } L.Push(fn) return 1 diff --git a/server/runtime_lua_nakama.go b/server/runtime_lua_nakama.go index 8d937bdab9..9f74adbfc2 100644 --- a/server/runtime_lua_nakama.go +++ b/server/runtime_lua_nakama.go @@ -2607,7 +2607,7 @@ func (n *RuntimeLuaNakamaModule) accountsGetId(l *lua.LState) int { userTable, err := userToLuaTable(l, account.User) if err != nil { - l.RaiseError(fmt.Sprintf("failed to convert user data to lua table: %s", err.Error())) + l.RaiseError("failed to convert user data to lua table: %s", err.Error()) return 0 } accountTable.RawSetString("user", userTable) @@ -2615,7 +2615,7 @@ func (n *RuntimeLuaNakamaModule) accountsGetId(l *lua.LState) int { walletMap := make(map[string]int64) err = json.Unmarshal([]byte(account.Wallet), &walletMap) if err != nil { - l.RaiseError(fmt.Sprintf("failed to convert wallet to json: %s", err.Error())) + l.RaiseError("failed to convert wallet to json: %s", err.Error()) return 0 } walletTable := RuntimeLuaConvertMapInt64(l, walletMap)