mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-01 14:38:50 +00:00
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:
1 parent
21e73c17b8
commit
bccd6a1035
3 files changed
+7
-6
No files matched your search
+3
-2
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user