mirror of
https://github.com/bjc/prosody.git
synced 2025-04-03 21:27:38 +03:00
util.error: Collect Application-Specific Conditions from stanza errors
This commit is contained in:
parent
3c7cbd0e2c
commit
a51d591246
2 changed files with 5 additions and 3 deletions
|
@ -48,13 +48,14 @@ 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", nil, "error.example");
|
||||
local e = st.error_reply(m, "modify", "bad-request", nil, "error.example"):tag("extra", { xmlns = "xmpp:example.test" });
|
||||
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);
|
||||
assert.not_nil(err.extra.tag);
|
||||
end);
|
||||
end);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue