diff options
author | Kim Alvefur <zash@zash.se> | 2020-08-28 13:55:05 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-08-28 13:55:05 +0200 |
commit | 3533f8e1b2e2f12ff1a49fdf2da91a9f50e9bf6c (patch) | |
tree | dccd01b47f4ecdbc68a864d5d1e0dd4d524a0231 /util | |
parent | 7e563605c92e6b7ee609c33b622a1ca86b6956c4 (diff) | |
download | prosody-3533f8e1b2e2f12ff1a49fdf2da91a9f50e9bf6c.tar.gz prosody-3533f8e1b2e2f12ff1a49fdf2da91a9f50e9bf6c.zip |
util.error: Add a wrapper for common parameters
Lets you set up source and registry once per module
Diffstat (limited to 'util')
-rw-r--r-- | util/error.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/util/error.lua b/util/error.lua index 600c9e5e..c46f8790 100644 --- a/util/error.lua +++ b/util/error.lua @@ -52,6 +52,12 @@ local function new(e, context, registry, source) }, error_mt); end +local function init(source, registry) + return function (e, context) + return new(e, context, registry, source); + end +end + local function coerce(ok, err, ...) if ok or is_err(err) then return ok, err, ...; @@ -79,6 +85,7 @@ end return { new = new; + init = init; coerce = coerce; is_err = is_err; from_stanza = from_stanza; |