fix: error handling when using callbacks

Only allow manual error handling when using the await/sync methods,
or when calling the default exports.

Async/Callback returns need to throw errors for compatibility.
This commit is contained in:
Linden committed 2022-06-17 21:40:27 +10:00
1 parent 21e73c17b8
commit bccd6a1035
3 files changed
+7 -6

No files matched your search

+3 -2
View File
@@ -74,7 +74,7 @@ local function await(fn, query, parameters)
end
p:resolve(result)
end, GetCurrentResourceName)
end, GetCurrentResourceName, false)
return Await(p)
end
@@ -85,7 +85,8 @@ setmetatable(MySQL, {
self[method] = setmetatable({}, {
__call = function(_, query, parameters, cb)
return oxmysql[method](nil, safeArgs(query, parameters, cb, method == 'transaction'))
query, parameters, cb = safeArgs(query, parameters, cb, method == 'transaction')
return oxmysql[method](nil, query, parameters, cb, GetCurrentResourceName, true)
end,
__index = function(_, index)