You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
425 B
15 lines
425 B
// this safe handler is used to wrap our api methods
|
|
// so that we always fallback and return an exception if there is an error
|
|
// inside of an async function
|
|
// Mostly copied from vault/server/utils/safeHandler.js
|
|
function safeHandler(handler) {
|
|
return async(req, res, next) => {
|
|
try {
|
|
return await handler(req, res, next);
|
|
} catch (err) {
|
|
return next(err);
|
|
}
|
|
};
|
|
}
|
|
|
|
module.exports = safeHandler;
|
|
|