Software /
code /
prosody
Comparison
net/http/server.lua @ 10501:e8186aba1583
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 14 Dec 2019 20:28:44 +0100 |
parent | 10396:3278f2a31a0a |
child | 10719:977c9883f625 |
comparison
equal
deleted
inserted
replaced
10500:493cbfe99b64 | 10501:e8186aba1583 |
---|---|
189 body = events.fire_event("http-error", { request = request, response = response, code = result }); | 189 body = events.fire_event("http-error", { request = request, response = response, code = result }); |
190 end | 190 end |
191 elseif result_type == "string" then | 191 elseif result_type == "string" then |
192 body = result; | 192 body = result; |
193 elseif errors.is_err(result) then | 193 elseif errors.is_err(result) then |
194 body = events.fire_event("http-error", { request = request, response = response, code = result.code, error = result }); | 194 body = events.fire_event("http-error", { request = request, response = response, code = result.code or 500, error = result }); |
195 elseif promise.is_promise(result) then | 195 elseif promise.is_promise(result) then |
196 result:next(function (ret) | 196 result:next(function (ret) |
197 handle_result(request, response, ret); | 197 handle_result(request, response, ret); |
198 end, function (err) | 198 end, function (err) |
199 handle_result(request, response, err or 500); | 199 handle_result(request, response, err or 500); |