aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spec/util_error_spec.lua8
-rw-r--r--util/error.lua2
2 files changed, 10 insertions, 0 deletions
diff --git a/spec/util_error_spec.lua b/spec/util_error_spec.lua
index ca053285..136f8b12 100644
--- a/spec/util_error_spec.lua
+++ b/spec/util_error_spec.lua
@@ -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);
diff --git a/util/error.lua b/util/error.lua
index cfb35350..e0b1f9a6 100644
--- a/util/error.lua
+++ b/util/error.lua
@@ -43,6 +43,7 @@ local function new(e, context, registry, source)
type = e.type;
condition = e.condition;
text = e.text;
+ extra = e.extra;
};
else
template = {};
@@ -61,6 +62,7 @@ local function new(e, context, registry, source)
condition = template.condition or "undefined-condition";
text = template.text;
code = template.code;
+ extra = template.extra;
context = context;
source = source;