2018-01-31 10:15:12 +00:00
|
|
|
module.exports = function catchErrors(done) {
|
2017-09-10 18:04:22 +00:00
|
|
|
return error => {
|
|
|
|
if (error instanceof Error) {
|
|
|
|
return done.fail(error.stack);
|
|
|
|
}
|
|
|
|
return done.fail(JSON.stringify(error));
|
|
|
|
};
|
2018-01-31 10:15:12 +00:00
|
|
|
};
|