strapi/packages/core/content-manager/utils/wrap-bad-request.js
Pierre Noël 2381e8c60b WIP
2021-07-20 12:12:36 +02:00

17 lines
375 B
JavaScript

'use strict';
module.exports = fn => async (...args) => {
try {
await fn(...args);
} catch (error) {
if (strapi.errors.isBoom(error)) {
throw error;
}
// these are errors like unique constraints
console.log(error);
strapi.log.error(error);
throw strapi.errors.badRequest('Invalid input data. Please verify unique constraints');
}
};