Commit e9f4c7ed authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Improve runtime single wallet update error results.

parent 6317c6a2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
- Update RegisterLeaderboardReset runtime function signature.
- Cancel runtime context when graceful shutdown completes.
- Add button to Nakama Console UI to allow device IDs to be copied.
- Improve runtime single wallet update error results.

### Fixed
- Ensure all members are correctly listed in party info when there are multiple concurrent successful joins.
+5 −0
Original line number Diff line number Diff line
@@ -1216,6 +1216,11 @@ func (n *RuntimeGoNakamaModule) WalletUpdate(ctx context.Context, userID string,
		return results[0].Updated, results[0].Previous, err
	}

	if len(results) == 0 {
		// May happen if user ID does not exist.
		return nil, nil, errors.New("user not found")
	}

	return results[0].Updated, results[0].Previous, nil
}

+1 −1
Original line number Diff line number Diff line
@@ -3071,7 +3071,7 @@ func (n *runtimeJavascriptNakamaModule) walletUpdate(r *goja.Runtime) func(goja.
		}

		if len(results) == 0 {
			return goja.Null()
			panic(r.NewTypeError("user not found"))
		}

		return r.ToValue(map[string]interface{}{
+6 −0
Original line number Diff line number Diff line
@@ -4322,6 +4322,12 @@ func (n *RuntimeLuaNakamaModule) walletUpdate(l *lua.LState) int {
		l.RaiseError(fmt.Sprintf("failed to update user wallet: %s", err.Error()))
	}

	if len(results) == 0 {
		// May happen if user ID does not exist.
		l.RaiseError("user not found")
		return 0
	}

	l.Push(RuntimeLuaConvertMapInt64(l, results[0].Updated))
	l.Push(RuntimeLuaConvertMapInt64(l, results[0].Previous))
	return 2