mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 07:26:02 +01:00
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:
@@ -50,7 +50,7 @@ local function triggerServerCallback(_, event, delay, cb, ...)
|
|||||||
return promise:resolve(response and { msgpack.unpack(response) } or {})
|
return promise:resolve(response and { msgpack.unpack(response) } or {})
|
||||||
end
|
end
|
||||||
|
|
||||||
return cb and cb(msgpack.unpack(response))
|
return cb and cb(response and msgpack.unpack(response))
|
||||||
end
|
end
|
||||||
|
|
||||||
if promise then
|
if promise then
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ local function triggerClientCallback(_, event, playerId, cb, ...)
|
|||||||
return promise:resolve(response and { msgpack.unpack(response) } or {})
|
return promise:resolve(response and { msgpack.unpack(response) } or {})
|
||||||
end
|
end
|
||||||
|
|
||||||
return cb and cb(msgpack.unpack(response))
|
return cb and cb(response and msgpack.unpack(response))
|
||||||
end
|
end
|
||||||
|
|
||||||
if promise then
|
if promise then
|
||||||
@@ -75,3 +75,5 @@ function lib.callback.register(name, cb)
|
|||||||
end
|
end
|
||||||
|
|
||||||
return lib.callback
|
return lib.callback
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user