You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a expressWinston.logger and expressWinston.errorLogger setup currently. If my application throws an error, say 403 for instance, the expressWinston.logger will log that correctly. Example:
The issue is that the errorLogger does not correctly report the statusCode properly. It will always return 200 rendering the message {{res.statusCode}} field useless for me. See:
{meta: {error: .../serverError.ts:25
returnnewException(errObj.status,errObj.message,errObj.errorCode)^Error: Userdoesnothavepermissionstocreateormodifyusers
...
status: 403,errorCode: '70060'},level: 'error',message: 'uncaughtException: User does not have permissions to create or modify users\n ...'exception: true,date: 'Thu Oct 13 2022 17:06:57 GMT+0000 (Coordinated Universal Time)',process: {...},os: { ... },trace: [...],req: {url: '...,
headers: {...},method: 'PATCH',httpVersion: '1.1',originalUrl: '...',query: {}}},level: '\x1B[31merror\x1B[39m',message: 'User does not have permissions to create or modify users - 200 PATCH ...'}
and the config for the errorLogger (note this isn't my live prod code, just something I modified to reproduce the error in my app):
Question: Is this a known issue? Or is there something wrong my my config? Or is there an issue with how my error is being thrown? What am I missing? I want my errorLogger to accurately report the 403 error.
The text was updated successfully, but these errors were encountered:
Versions:
I have a
expressWinston.logger
andexpressWinston.errorLogger
setup currently. If my application throws an error, say403
for instance, theexpressWinston.logger
will log that correctly. Example:The issue is that the
errorLogger
does not correctly report the statusCode properly. It will always return200
rendering the message{{res.statusCode}}
field useless for me. See:and the config for the errorLogger (note this isn't my live prod code, just something I modified to reproduce the error in my app):
Question: Is this a known issue? Or is there something wrong my my config? Or is there an issue with how my error is being thrown? What am I missing? I want my
errorLogger
to accurately report the403
error.The text was updated successfully, but these errors were encountered: