Comparison

util/error.lua @ 11078:fb3aec3dbe21

util.error: Have init() return an object to allow API extensibility via additional methods
author Matthew Wild <mwild1@gmail.com>
date Fri, 25 Sep 2020 12:32:43 +0100
parent 11077:8ea430de5fd3
child 11079:1e5a0e0469de
comparison
equal deleted inserted replaced
11077:8ea430de5fd3 11078:fb3aec3dbe21
56 56
57 return error_instance; 57 return error_instance;
58 end 58 end
59 59
60 local function init(source, registry) 60 local function init(source, registry)
61 return function (e, context) 61 return {
62 return new(e, context, registry, source); 62 new = function (e, context)
63 end 63 return new(e, context, registry, source);
64 end;
65 };
64 end 66 end
65 67
66 local function coerce(ok, err, ...) 68 local function coerce(ok, err, ...)
67 if ok or is_err(err) then 69 if ok or is_err(err) then
68 return ok, err, ...; 70 return ok, err, ...;