Mercurial > prosody-hg
comparison spec/util_error_spec.lua @ 11081:0b68697450c5
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>
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 26 Sep 2020 17:16:34 +0200 |
| parents | 744ca71a49f7 |
| children | 35d2260644d9 |
comparison
equal
deleted
inserted
replaced
| 11080:ba77c142c9b1 | 11081:0b68697450c5 |
|---|---|
| 64 tostring(errors.new()); | 64 tostring(errors.new()); |
| 65 end); | 65 end); |
| 66 end); | 66 end); |
| 67 end); | 67 end); |
| 68 | 68 |
| 69 describe("extra", function () | |
| 70 it("keeps some extra fields", function () | |
| 71 local err = errors.new({condition="gone",text="Sorry mate, it's all gone",extra={uri="file:///dev/null"}}); | |
| 72 assert.is_table(err.extra); | |
| 73 assert.equal("file:///dev/null", err.extra.uri); | |
| 74 end); | |
| 75 end) | |
| 76 | |
| 69 end); | 77 end); |
| 70 | 78 |
