Software /
code /
prosody
Comparison
util/error.lua @ 10493:d9132e7412b8
util.error: Write down some thoughts in comments
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 08 Dec 2019 17:00:45 +0100 |
parent | 10365:744ca71a49f7 |
child | 10501:e8186aba1583 |
comparison
equal
deleted
inserted
replaced
10492:8e1d9bba9244 | 10493:d9132e7412b8 |
---|---|
5 end | 5 end |
6 | 6 |
7 local function is_err(e) | 7 local function is_err(e) |
8 return getmetatable(e) == error_mt; | 8 return getmetatable(e) == error_mt; |
9 end | 9 end |
10 | |
11 -- Do we want any more well-known fields? | |
12 -- Or could we just copy all fields from `e`? | |
13 -- Sometimes you want variable details in the `text`, how to handle that? | |
14 -- Translations? | |
15 -- Should the `type` be restricted to the stanza error types or free-form? | |
16 -- What to set `type` to for stream errors or SASL errors? Those don't have a 'type' attr. | |
10 | 17 |
11 local function new(e, context, registry) | 18 local function new(e, context, registry) |
12 local template = (registry and registry[e]) or e or {}; | 19 local template = (registry and registry[e]) or e or {}; |
13 return setmetatable({ | 20 return setmetatable({ |
14 type = template.type or "cancel"; | 21 type = template.type or "cancel"; |