[redbean] Add details to OnError Hook (#1324)

The details of the error was missing, this PR add details to the OnError
hook so we can now get why the error occurs
This commit is contained in:
BONNAURE Olivier 2024-11-20 22:55:45 +01:00 committed by GitHub
parent 1312f60245
commit ad0a7c67c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View file

@ -2620,7 +2620,8 @@ static char *ServeErrorImpl(unsigned code, const char *reason,
lua_getglobal(L, "OnError");
lua_pushinteger(L, code);
lua_pushstring(L, reason);
if (LuaCallWithTrace(L, 2, 0, NULL) == LUA_OK) {
lua_pushstring(L, details);
if (LuaCallWithTrace(L, 3, 0, NULL) == LUA_OK) {
return CommitOutput(GetLuaResponse());
} else {
return ServeErrorImplDefault(code, reason, details);