Diff

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
line wrap: on
line diff
--- a/spec/util_error_spec.lua	Fri Nov 01 18:11:58 2019 +0100
+++ b/spec/util_error_spec.lua	Fri Nov 01 18:31:12 2019 +0100
@@ -16,11 +16,13 @@
 					["fail"] = {
 						type = "wait",
 						condition = "internal-server-error",
+						code = 555;
 					};
 				};
 				local err = errors.new("fail", { traceback = "in some file, somewhere" }, templates);
 				assert.equal("wait", err.type);
 				assert.equal("internal-server-error", err.condition);
+				assert.equal(555, err.code);
 				assert.same({ traceback = "in some file, somewhere" }, err.context);
 			end);
 		end);