mirror of
https://github.com/strapi/strapi.git
synced 2025-09-01 21:03:02 +00:00
Merge branch 'master' into fix/5439
This commit is contained in:
commit
06ba800a1b
@ -80,9 +80,13 @@ module.exports = strapi => {
|
||||
}
|
||||
|
||||
// Log error.
|
||||
strapi.log.error(error);
|
||||
|
||||
const { status, body } = formatBoomPayload(error);
|
||||
|
||||
if (status >= 500) {
|
||||
strapi.log.error(error);
|
||||
}
|
||||
|
||||
ctx.body = body;
|
||||
ctx.status = status;
|
||||
}
|
||||
@ -101,13 +105,13 @@ module.exports = strapi => {
|
||||
// Custom function to avoid ctx.body repeat
|
||||
createResponses() {
|
||||
boomMethods.forEach(method => {
|
||||
strapi.app.response[method] = function(...rest) {
|
||||
const boomError = Boom[method](...rest) || {};
|
||||
strapi.app.response[method] = function(msg, ...rest) {
|
||||
const boomError = Boom[method](msg, ...rest) || {};
|
||||
|
||||
const { status, body } = formatBoomPayload(boomError);
|
||||
|
||||
// keep retro-compatibility for old error formats
|
||||
body.message = body.data;
|
||||
body.message = msg || body.data || body.message;
|
||||
|
||||
this.body = body;
|
||||
this.status = status;
|
||||
|
Loading…
x
Reference in New Issue
Block a user