fix(callback): bad argument to unpack when callback throws error

Throwing an error responds with false rather than a string.
This commit is contained in:
Linden
2022-10-19 20:20:38 +11:00
parent 6f0bf6a624
commit 2bb0d68415
2 changed files with 5 additions and 3 deletions

View File

@@ -31,7 +31,7 @@ local function triggerClientCallback(_, event, playerId, cb, ...)
return promise:resolve(response and { msgpack.unpack(response) } or {})
end
return cb and cb(msgpack.unpack(response))
return cb and cb(response and msgpack.unpack(response))
end
if promise then
@@ -74,4 +74,6 @@ function lib.callback.register(name, cb)
end)
end
return lib.callback
return lib.callback