fix copying array of errors and adding error.label to logs
This commit is contained in:
parent
60e4defa66
commit
605d7057c9
@ -163,7 +163,7 @@ function errorMessageWithContext(err) {
|
||||
}
|
||||
|
||||
function logErrors(errors, statusCode, res) {
|
||||
const errorsCopy = Object.assign({}, errors);
|
||||
const errorsCopy = errors.slice(0);
|
||||
|
||||
if(!errorsCopy || !errorsCopy.length) {
|
||||
return;
|
||||
@ -175,6 +175,7 @@ function logErrors(errors, statusCode, res) {
|
||||
statusCode: statusCode || 200,
|
||||
message: mainError.message,
|
||||
name: mainError.name,
|
||||
label: mainError.label,
|
||||
type: mainError.type,
|
||||
subtype: mainError.subtype
|
||||
};
|
||||
@ -183,6 +184,7 @@ function logErrors(errors, statusCode, res) {
|
||||
return {
|
||||
message: error.message,
|
||||
name: error.name,
|
||||
label: error.label,
|
||||
type: error.type,
|
||||
subtype: error.subtype
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user