aboutsummaryrefslogtreecommitdiffstats
path: root/net/http
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-12-14 20:28:44 +0100
committerKim Alvefur <zash@zash.se>2019-12-14 20:28:44 +0100
commit87d0125802ce38410e5d429c90760802dec0397c (patch)
tree0a95c01ae6126380af2c12b5fea24030106aaf0f /net/http
parentffcb8303ccdc3dc6c0cceae7c7a9ba8d2de5aa65 (diff)
downloadprosody-87d0125802ce38410e5d429c90760802dec0397c.tar.gz
prosody-87d0125802ce38410e5d429c90760802dec0397c.zip
util.error: Move default for numeric error code to net.http.server
Stanza errors can also have numbers but these are a legacy thing and rarely used, except in MUC. HTTP errors on the other hand always have a number.
Diffstat (limited to 'net/http')
-rw-r--r--net/http/server.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index 47f064a5..f4f67d18 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -191,7 +191,7 @@ local function handle_result(request, response, result)
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 });
+ body = events.fire_event("http-error", { request = request, response = response, code = result.code or 500, error = result });
elseif promise.is_promise(result) then
result:next(function (ret)
handle_result(request, response, ret);