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.
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.
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
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