cloning object and removing logs
This commit is contained in:
parent
84fd01535c
commit
f24217a400
@ -19,7 +19,7 @@ module.exports = function errorMiddleware (/* options */) {
|
|||||||
statusCode = 204;
|
statusCode = 204;
|
||||||
}
|
}
|
||||||
|
|
||||||
logErrors(allErrors, statusCode, res);
|
logErrors(Object.assign({}, allErrors), statusCode, res);
|
||||||
debug('[%s ERROR] -- %d: %s, %s', label, statusCode, err, err.stack);
|
debug('[%s ERROR] -- %d: %s, %s', label, statusCode, err, err.stack);
|
||||||
|
|
||||||
// If a callback was requested, force status to 200
|
// If a callback was requested, force status to 200
|
||||||
@ -164,10 +164,6 @@ function errorMessageWithContext(err) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function logErrors(errors, statusCode, res) {
|
function logErrors(errors, statusCode, res) {
|
||||||
console.log(' -----------------------------')
|
|
||||||
console.log('logErrors');
|
|
||||||
console.log(' -----------------------------')
|
|
||||||
|
|
||||||
if(!errors || !errors.length || !statusCode) {
|
if(!errors || !errors.length || !statusCode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -179,7 +175,7 @@ function logErrors(errors, statusCode, res) {
|
|||||||
message: mainError.message,
|
message: mainError.message,
|
||||||
type: mainError.type,
|
type: mainError.type,
|
||||||
subtype: mainError.subtype
|
subtype: mainError.subtype
|
||||||
}
|
};
|
||||||
|
|
||||||
errorsLog.moreErrors = errors.map(error => {
|
errorsLog.moreErrors = errors.map(error => {
|
||||||
return {
|
return {
|
||||||
@ -189,9 +185,5 @@ function logErrors(errors, statusCode, res) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(' -----------------------------')
|
|
||||||
console.log(errorsLog)
|
|
||||||
console.log(' -----------------------------')
|
|
||||||
|
|
||||||
res.set('X-Tiler-Errors', JSON.stringify(errorsLog));
|
res.set('X-Tiler-Errors', JSON.stringify(errorsLog));
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user