aboutsummaryrefslogtreecommitdiffstats
path: root/util/error.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-09-26 18:13:27 +0200
committerKim Alvefur <zash@zash.se>2020-09-26 18:13:27 +0200
commit0354452a9a537d141e61d09b553e1ceadf97cf42 (patch)
treeecde3fd50818d213291123221a1463e4de9d32e5 /util/error.lua
parent815ce25d10e49f4efa7b402c8d5b03a0f63474f1 (diff)
downloadprosody-0354452a9a537d141e61d09b553e1ceadf97cf42.tar.gz
prosody-0354452a9a537d141e61d09b553e1ceadf97cf42.zip
util.error: Extract error originator from stanza errors
Diffstat (limited to 'util/error.lua')
-rw-r--r--util/error.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/util/error.lua b/util/error.lua
index e0b1f9a6..c2b7d149 100644
--- a/util/error.lua
+++ b/util/error.lua
@@ -93,12 +93,17 @@ end
local function from_stanza(stanza, context)
local error_type, condition, text = stanza:get_error();
+ local error_tag = stanza:get_child("error");
+ context = context or {};
+ context.stanza = stanza;
+ context.by = error_tag.attr.by;
return setmetatable({
type = error_type or "cancel";
condition = condition or "undefined-condition";
text = text;
- context = context or { stanza = stanza };
+ context = context;
+
}, error_mt);
end