mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Format database-related error responses
Closes #4735 - Shows error message on client instead of "[object Object]". - Server log shows error message instead of uknown error.
This commit is contained in:
parent
8454a1c0bb
commit
786ec6be28
1 changed files with 9 additions and 0 deletions
|
@ -193,6 +193,15 @@ errors = {
|
||||||
return this.rejectError(error);
|
return this.rejectError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handle database errors
|
||||||
|
if (error.code && (error.errno || error.detail)) {
|
||||||
|
error.db_error_code = error.code;
|
||||||
|
error.type = 'DatabaseError';
|
||||||
|
error.code = 500;
|
||||||
|
|
||||||
|
return this.rejectError(error);
|
||||||
|
}
|
||||||
|
|
||||||
return this.rejectError(new this.InternalServerError(error));
|
return this.rejectError(new this.InternalServerError(error));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue