aboutsummaryrefslogtreecommitdiffstats
path: root/util/error.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-09-28 18:39:51 +0200
committerKim Alvefur <zash@zash.se>2020-09-28 18:39:51 +0200
commit5da983d8bdc574f9358a16eb08d700dde3ca7026 (patch)
treed64c07f7c26700b2a07473d9ef1581da14384973 /util/error.lua
parent9a5debbb9fbbfb19a5112b2f8cfda3ba8f936dfb (diff)
downloadprosody-5da983d8bdc574f9358a16eb08d700dde3ca7026.tar.gz
prosody-5da983d8bdc574f9358a16eb08d700dde3ca7026.zip
util.error: Add a "compact mode" for registries
Inspired by the older registry in pubsub.lib.lua
Diffstat (limited to 'util/error.lua')
-rw-r--r--util/error.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/util/error.lua b/util/error.lua
index 47d4e7b6..2e4118ec 100644
--- a/util/error.lua
+++ b/util/error.lua
@@ -58,11 +58,14 @@ local function new(e, context, registry, source)
local error_instance = setmetatable({
instance_id = id.short();
- type = template.type or "cancel";
- condition = template.condition or "undefined-condition";
- text = template.text;
+ type = template.type or template[1] or "cancel";
+ condition = template.condition or template[2] or "undefined-condition";
+ text = template.text or template[3];
code = template.code;
- extra = template.extra;
+ extra = template.extra or (registry and registry.namespace and template[4] and {
+ namespace = registry.namespace;
+ condition = template[4]
+ });
context = context;
source = source;