mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 05:37:39 +03:00
util.error: Extract error originator from stanza errors
This commit is contained in:
parent
815ce25d10
commit
0354452a9a
2 changed files with 8 additions and 2 deletions
|
@ -48,12 +48,13 @@ describe("util.error", function ()
|
|||
it("works", function ()
|
||||
local st = require "util.stanza";
|
||||
local m = st.message({ type = "chat" });
|
||||
local e = st.error_reply(m, "modify", "bad-request");
|
||||
local e = st.error_reply(m, "modify", "bad-request", nil, "error.example");
|
||||
local err = errors.from_stanza(e);
|
||||
assert.truthy(errors.is_err(err));
|
||||
assert.equal("modify", err.type);
|
||||
assert.equal("bad-request", err.condition);
|
||||
assert.equal(e, err.context.stanza);
|
||||
assert.equal("error.example", err.context.by);
|
||||
end);
|
||||
end);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue