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
@ -193,6 +193,15 @@ errors = {
|
||||
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));
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user