aboutsummaryrefslogtreecommitdiffstats
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
commit4f6f98131e29535594b8e53f97d2f9a8914ad05d (patch)
tree60b47c78046a77f10330d1717099dbc29badf143
parent93500d02d77f1541cbe952bf3b89f2e73f2ad031 (diff)
downloadprosody-4f6f98131e29535594b8e53f97d2f9a8914ad05d.tar.gz
prosody-4f6f98131e29535594b8e53f97d2f9a8914ad05d.zip
util.error: Minor tweaks to error creation code to prepare for future changes
-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)