1 | ;
|
2 |
|
3 | /**
|
4 | * Returns a function that calls res.error
|
5 | *
|
6 | * @param {Response} res use as res.reject(...)
|
7 | * @param {string} [audit=false] audit event type
|
8 | * @param {string} [extra=undefined] extra audit payload which may help debug event
|
9 | */
|
10 | function reject(res, audit = false, extra = undefined)
|
11 | {
|
12 | return function (err)
|
13 | {
|
14 | // console.error(err);
|
15 | res.error(err && err.message || err, audit, extra);
|
16 | };
|
17 | }
|
18 |
|
19 | module.exports = reject;
|