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
In the commands/query framework we throw 3 types of errors:
InvalidInput: equivalent to AppError
InvalidState: equivalent to ServerError
InvalidActor: authentication error (no explicit equivalent just errors thrown by passport)
These errors are not properly supported by setupErrorHandlers.ts. For example, if you set up a command that throws an InvalidInput error and integrate it using the express adapter, the error will be returned as an HTTP 500 error. We need to map the above errors to relevant error codes in setupErrorHandlers.ts
Additional context
The text was updated successfully, but these errors were encountered:
We have error middleware in /libs/adapters/express/middleware.ts, which can be added to the integration routers using the express adapter.... or do we need to merge this with the legacy error handlers?
We have error middleware in /libs/adapters/express/middleware.ts, which can be added to the integration routers using the express adapter.... or do we need to merge this with the legacy error handlers?
I hadn't seen that middleware. The middleware that currently applies is setupErrorHandlers because it handles errors globally across all routes on the express app. Is there a reason this error handling middleware is not applied to any of the new express routers?
Also it does seem that we need to modify it because logging is incorrect in that middleware. It is using console.log when it should be using log.error for all 500 errors.
Description
In the commands/query framework we throw 3 types of errors:
InvalidInput
: equivalent to AppErrorInvalidState
: equivalent to ServerErrorInvalidActor
: authentication error (no explicit equivalent just errors thrown by passport)These errors are not properly supported by
setupErrorHandlers.ts
. For example, if you set up a command that throws anInvalidInput
error and integrate it using the express adapter, the error will be returned as an HTTP 500 error. We need to map the above errors to relevant error codes insetupErrorHandlers.ts
Additional context
The text was updated successfully, but these errors were encountered: