Assert or throw a Boom Error
# With yarn
yarn add assert-or-boom
# Or with npm
npm i assert-or-boom
const aOrB = require('assert-or-boom');
const boom = require('boom');
try {
aOrB(true, 500, 'Internal Error');
} catch (err) {
Boom.isBoom(err); // => true
}
- aOrB like assert with Boom;
- assertOrBam like assert but output an error with a payload;
- orBoom throw a Boom error;
- orBam throw an error with a payload;
- is functions list of is functions taken from
@sindresohrus/is
; - isNot functions like is but is not;
- or functions functions to throw a specific Boom error;