diff --git a/tool/net/help.txt b/tool/net/help.txt index a217b7f07..5c722e294 100644 --- a/tool/net/help.txt +++ b/tool/net/help.txt @@ -569,7 +569,7 @@ HOOKS *). See functions like Route which asks redbean to do its default thing from the handler. - OnError(status:int, message:string) + OnError(status:int, message:string, details:string) If this function is defined and if any errors occurs in OnHttpRequest() then this method will be called instead of displaying the default error page. Useful if you need to display the error page diff --git a/tool/net/redbean.c b/tool/net/redbean.c index 1000ffc2c..9182faed2 100644 --- a/tool/net/redbean.c +++ b/tool/net/redbean.c @@ -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);