-
Notifications
You must be signed in to change notification settings - Fork 988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring backend codebase to use central error handling and logging #152
Commits on Dec 21, 2022
-
feat: Add central error handler
Added: - Added Midleware to capture and handle all errors - will catch error from `throw ...` and `next(...)` - Added RequestError base error class to build consistent error objects - Added common errors like `UnauthorizedRequestError`, `BadRequestError` - Added consistent Logging solution using `winston` - Supports Loki Transporter using `winston-loki` - Outputing Legal disclaimer to console when `TELEMETRY_ENABLED=true` Changed: - Changed console.log to getLogger() favor of using consistent logging
Configuration menu - View commit details
-
Copy full SHA for bd9041a - Browse repository at this point
Copy the full SHA bd9041aView commit details
Commits on Dec 22, 2022
-
refactor: Refactored middlewares to use RequestError
Refactored middlewares to use RequestError rather than using `try {...}catch (err){...}`. With this change it's possible to manage all error details within one place. Added: - Added Sentry.captureException to Error Handler
Configuration menu - View commit details
-
Copy full SHA for 6f5d7a8 - Browse repository at this point
Copy the full SHA 6f5d7a8View commit details -
fix: Wrong error handler middleware position
Error handler is a middleware that captures errors from throw and next(...), so in order to be able to handle it needs to come after all of the routing and other middlewares. Previously it was before routuing logic and wasn't working, now it works as intended. Also added check for LogLevel to Sentry for not sending false-positive errors like `BadRequestError`, `UnauthorizedRequestError` and etc.
Configuration menu - View commit details
-
Copy full SHA for 843757f - Browse repository at this point
Copy the full SHA 843757fView commit details
Commits on Dec 24, 2022
-
refactor: Prefer use of RequestError and next() function on middlewares
Added: - New error types such as `IntegrationNotFoundError`, `WorkspaceNotFoundError`, `AccountNotFoundError' and more. Refactored: - Refactored most of the middlewares and very little number of helper functions to use RequestError - Deleted unused imports Changed: - Some of the error types in middlewares changed to more related error types. - Environment variable of 'VERBOSE_ERROR_OUTPUT' changed to more reliable validation method in `config/index.ts` as per @dangtony98 requested.
Configuration menu - View commit details
-
Copy full SHA for 28818db - Browse repository at this point
Copy the full SHA 28818dbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6216f70 - Browse repository at this point
Copy the full SHA 6216f70View commit details -
Configuration menu - View commit details
-
Copy full SHA for 22d6aa8 - Browse repository at this point
Copy the full SHA 22d6aa8View commit details -
feat: Patch Router#handle to catch Promise Rejection
In order to catch Promise rejections inside and outside of middlewares as well as in route logic we need to patch `Router#handle` and add .catch() to the function. With that addition it is possible to catch rejections and handle inside `requestErrorHandler` middleware.
Configuration menu - View commit details
-
Copy full SHA for d72e113 - Browse repository at this point
Copy the full SHA d72e113View commit details
Commits on Dec 25, 2022
-
Configuration menu - View commit details
-
Copy full SHA for a12ae35 - Browse repository at this point
Copy the full SHA a12ae35View commit details