Mercurial > prosody-hg
comparison util/error.lua @ 10365:744ca71a49f7
util.error: Add well-known field 'code' in error templates
Intended to be for HTTP-ish numeric status codes
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 01 Nov 2019 18:31:12 +0100 |
| parents | 6f317e51544d |
| children | d9132e7412b8 |
comparison
equal
deleted
inserted
replaced
| 10364:66943afdd7f3 | 10365:744ca71a49f7 |
|---|---|
| 12 local template = (registry and registry[e]) or e or {}; | 12 local template = (registry and registry[e]) or e or {}; |
| 13 return setmetatable({ | 13 return setmetatable({ |
| 14 type = template.type or "cancel"; | 14 type = template.type or "cancel"; |
| 15 condition = template.condition or "undefined-condition"; | 15 condition = template.condition or "undefined-condition"; |
| 16 text = template.text; | 16 text = template.text; |
| 17 code = template.code or 500; | |
| 17 | 18 |
| 18 context = context or template.context or { _error_id = e }; | 19 context = context or template.context or { _error_id = e }; |
| 19 }, error_mt); | 20 }, error_mt); |
| 20 end | 21 end |
| 21 | 22 |
