Recommended way to log errors thrown by authenticate
?
#648
Replies: 2 comments
-
|
Beta Was this translation helpful? Give feedback.
-
Log to STDOUT or STDERR. Manage your app systemd or another supervisor that captures STDOUT and STDERR and sends the logs to a logging service, like rsyslog. Have your logging service across your redundant production web servers send the logs to a log aggregation service, like AWS CloudWatch Logs or Rapid7 InsightOps. Using your log aggregator, set up alerts to notify you immediately for patterns you care about. Alternately, if there's a condition that you would always consider an error, sending it directly to a error tracking service like BugSnag. Set up BugSnag->Slack integration to get notified immediately through a chat service. This is general advice for logging, You asked about logging errors, not handling them in general.
This project could improve the error handling experience, by instead using a project like https://www.npmjs.com/package/common-errors#notpermitted From there, an Express middleware can catch unhandled errors from these classes and convert them into related user error codes like "403 Forbidden". https://www.npmjs.com/package/common-errors#errorhandler
Then SAML errors could also be translated automatically into HTTP response codes or you could write your own checks against these custom error classes instead of matching error strings with a regex to see if they are SAML errors or not. |
Beta Was this translation helpful? Give feedback.
-
What would be the recommended way to log errors like:
and other errors that may be thrown?
On documentation I only found references to
req.flash
.Thanks :)
Beta Was this translation helpful? Give feedback.
All reactions