Software /
code /
prosody
Comparison
spec/util_error_spec.lua @ 10365:744ca71a49f7
util.error: Add well-known field 'code' in error templates
Intended to be for HTTP-ish numeric status codes
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 01 Nov 2019 18:31:12 +0100 |
parent | 10101:ba7636860bbc |
child | 11081:0b68697450c5 |
comparison
equal
deleted
inserted
replaced
10364:66943afdd7f3 | 10365:744ca71a49f7 |
---|---|
14 it("works", function () | 14 it("works", function () |
15 local templates = { | 15 local templates = { |
16 ["fail"] = { | 16 ["fail"] = { |
17 type = "wait", | 17 type = "wait", |
18 condition = "internal-server-error", | 18 condition = "internal-server-error", |
19 code = 555; | |
19 }; | 20 }; |
20 }; | 21 }; |
21 local err = errors.new("fail", { traceback = "in some file, somewhere" }, templates); | 22 local err = errors.new("fail", { traceback = "in some file, somewhere" }, templates); |
22 assert.equal("wait", err.type); | 23 assert.equal("wait", err.type); |
23 assert.equal("internal-server-error", err.condition); | 24 assert.equal("internal-server-error", err.condition); |
25 assert.equal(555, err.code); | |
24 assert.same({ traceback = "in some file, somewhere" }, err.context); | 26 assert.same({ traceback = "in some file, somewhere" }, err.context); |
25 end); | 27 end); |
26 end); | 28 end); |
27 | 29 |
28 end); | 30 end); |