Software /
code /
prosody
Comparison
util/error.lua @ 11161:f51ed2652602
util.error: Pass through existing error objects passed to new()
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 15 Oct 2020 13:43:03 +0100 |
parent | 11102:5a0ff475ecfd |
child | 11207:4e060ae8520b |
comparison
equal
deleted
inserted
replaced
11160:e9eeaefa09a7 | 11161:f51ed2652602 |
---|---|
33 -- Translations? | 33 -- Translations? |
34 -- Should the `type` be restricted to the stanza error types or free-form? | 34 -- Should the `type` be restricted to the stanza error types or free-form? |
35 -- What to set `type` to for stream errors or SASL errors? Those don't have a 'type' attr. | 35 -- What to set `type` to for stream errors or SASL errors? Those don't have a 'type' attr. |
36 | 36 |
37 local function new(e, context, registry, source) | 37 local function new(e, context, registry, source) |
38 if is_err(e) then return e; end | |
38 local template = registry and registry[e]; | 39 local template = registry and registry[e]; |
39 if not template then | 40 if not template then |
40 if type(e) == "table" then | 41 if type(e) == "table" then |
41 template = { | 42 template = { |
42 code = e.code; | 43 code = e.code; |