chore: improves routeError log safety (#10793)
Improves the logging that `routeError` throws. Logs were sometimes being swallowed if there was a problem with the incoming request. Now they will surface.
This commit is contained in:
@@ -37,6 +37,12 @@ export const routeError = async ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let response = formatErrors(err)
|
||||||
|
|
||||||
|
let status = err.status || httpStatus.INTERNAL_SERVER_ERROR
|
||||||
|
|
||||||
|
logError({ err, payload })
|
||||||
|
|
||||||
const req = incomingReq as PayloadRequest
|
const req = incomingReq as PayloadRequest
|
||||||
|
|
||||||
req.payload = payload
|
req.payload = payload
|
||||||
@@ -47,12 +53,6 @@ export const routeError = async ({
|
|||||||
|
|
||||||
const { config } = payload
|
const { config } = payload
|
||||||
|
|
||||||
let response = formatErrors(err)
|
|
||||||
|
|
||||||
let status = err.status || httpStatus.INTERNAL_SERVER_ERROR
|
|
||||||
|
|
||||||
logError({ err, payload })
|
|
||||||
|
|
||||||
// Internal server errors can contain anything, including potentially sensitive data.
|
// Internal server errors can contain anything, including potentially sensitive data.
|
||||||
// Therefore, error details will be hidden from the response unless `config.debug` is `true`
|
// Therefore, error details will be hidden from the response unless `config.debug` is `true`
|
||||||
if (!config.debug && status === httpStatus.INTERNAL_SERVER_ERROR) {
|
if (!config.debug && status === httpStatus.INTERNAL_SERVER_ERROR) {
|
||||||
|
|||||||
Reference in New Issue
Block a user