aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/http/server.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index 0682d6ed..0d49dbce 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -13,6 +13,7 @@ local traceback = debug.traceback;
local tostring = tostring;
local cache = require "util.cache";
local codes = require "net.http.codes";
+local errors = require "util.error";
local blocksize = 2^16;
local _M = {};
@@ -188,6 +189,8 @@ local function handle_result(request, response, result)
end
elseif result_type == "string" then
body = result;
+ elseif errors.is_err(result) then
+ body = events.fire_event("http-error", { request = request, response = response, code = result.code, error = result });
elseif result_type == "table" then
for k, v in pairs(result) do
if k ~= "headers" then