INNER CODE UNIT · JavaScript
sendFailure
godaddy/terminus · lib/terminus.js:31
async function sendFailure (res, options) {
const { error, headers, onSendFailureDuringShutdown, exposeStackTraces, statusCode, statusResponse, statusError, statusErrorResponse } = options
function replaceErrors (_, value) {
if (value instanceof Error) {
const error = {}
Object.getOwnPropertyNames(value).forEach(function (key) {
if (exposeStackTraces !== true && key === 'stack') return
error[key] = value[key]
})
return error
}
return value
}