util.error: Add well-known field 'extra'

A place for various extra fields and edge cases of the stanza error data
model, e.g. the URI field of <gone>
This commit is contained in:
Kim Alvefur 2020-09-26 17:16:34 +02:00
parent a34633771d
commit ed5841e42b
2 changed files with 10 additions and 0 deletions

View file

@ -66,5 +66,13 @@ describe("util.error", function ()
end);
end);
describe("extra", function ()
it("keeps some extra fields", function ()
local err = errors.new({condition="gone",text="Sorry mate, it's all gone",extra={uri="file:///dev/null"}});
assert.is_table(err.extra);
assert.equal("file:///dev/null", err.extra.uri);
end);
end)
end);