Comparison

util/error.lua @ 11100:3aa06cdd2dc8

util.error: Add a "compact mode" for registries Inspired by the older registry in pubsub.lib.lua
author Kim Alvefur <zash@zash.se>
date Mon, 28 Sep 2020 18:39:51 +0200
parent 11098:5b778ec095f0
child 11101:2288d206b14b
comparison
equal deleted inserted replaced
11099:6fbfe2af4b4f 11100:3aa06cdd2dc8
56 end 56 end
57 57
58 local error_instance = setmetatable({ 58 local error_instance = setmetatable({
59 instance_id = id.short(); 59 instance_id = id.short();
60 60
61 type = template.type or "cancel"; 61 type = template.type or template[1] or "cancel";
62 condition = template.condition or "undefined-condition"; 62 condition = template.condition or template[2] or "undefined-condition";
63 text = template.text; 63 text = template.text or template[3];
64 code = template.code; 64 code = template.code;
65 extra = template.extra; 65 extra = template.extra or (registry and registry.namespace and template[4] and {
66 namespace = registry.namespace;
67 condition = template[4]
68 });
66 69
67 context = context; 70 context = context;
68 source = source; 71 source = source;
69 }, error_mt); 72 }, error_mt);
70 73