@house-agency/brewtils
Version:
The Brewery Node.js Utilities (brewtils)
23 lines (19 loc) • 458 B
Markdown
catch-default
=============
::javascript
const def = require('brewtils/catch-default');
// Catch an error by string
q.try(() => {
throw new Error('An error');
})
.catch(def('An error', your_callback));
// Catch an error by function
q.try(() => {
throw new Error('An error');
})
.catch(def(
error => {
return error.message === 'An error';
},
your_callback
));