Comparison

util/error.lua @ 11076:505c3e5907a5

util.error: Simplify error creation - remove ability to set context from templates, and remove default context
author Matthew Wild <mwild1@gmail.com>
date Fri, 25 Sep 2020 12:19:30 +0100
parent 11075:d8fad2b48b05
child 11077:8ea430de5fd3
comparison
equal deleted inserted replaced
11075:d8fad2b48b05 11076:505c3e5907a5
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 local template = (registry and registry[e]) or e or {}; 38 local template = (registry and registry[e]) or e or {};
39 context = context or template.context or { _error_id = e }; 39 context = context or {};
40 40
41 if auto_inject_traceback then 41 if auto_inject_traceback then
42 context.traceback = debug.traceback("error stack", 2); 42 context.traceback = debug.traceback("error stack", 2);
43 end 43 end
44 44