aboutsummaryrefslogtreecommitdiffstats
path: root/util/error.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-09-25 12:27:45 +0100
committerMatthew Wild <mwild1@gmail.com>2020-09-25 12:27:45 +0100
commit9c709d29fd4e37aeb41a9959889347e8d579273b (patch)
tree60b47c78046a77f10330d1717099dbc29badf143 /util/error.lua
parent73e87f3901e29b91662717b6cddb49b6f5d27858 (diff)
downloadprosody-9c709d29fd4e37aeb41a9959889347e8d579273b.tar.gz
prosody-9c709d29fd4e37aeb41a9959889347e8d579273b.zip
util.error: Minor tweaks to error creation code to prepare for future changes
Diffstat (limited to 'util/error.lua')
-rw-r--r--util/error.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/util/error.lua b/util/error.lua
index ade1bb3b..4079a876 100644
--- a/util/error.lua
+++ b/util/error.lua
@@ -42,16 +42,19 @@ local function new(e, context, registry, source)
context.traceback = debug.traceback("error stack", 2);
end
- return setmetatable({
+ local error_instance = setmetatable({
instance_id = id.short();
+
type = template.type or "cancel";
condition = template.condition or "undefined-condition";
text = template.text;
code = template.code;
- context = context or template.context or { _error_id = e };
+ context = context;
source = source;
}, error_mt);
+
+ return error_instance;
end
local function init(source, registry)