Following docs, we can't create multiple failure schemas for middleware, although that should be the case. For instance, the authorization middleware should be able to return either Unauthorized OR InternalServerError, for instance if something goes wrong with the DB query (db is down etc)
It should be possible to define multiple failure schemas, since realistically middleware can have internal server errors, and the intended errors like Unauthorized etc.
What do you see instead?
I can only provide one failure schema, which makes it so that if my DB is down, I still have to return Unauthorized with 401 status code which isn't correct. This makes it confusing to the user what went wrong. Also, we can't monitor for Internal Server Errors, since the middleware can return only Unauthorized, even if something went horribly wrong.
What version of Effect is running?
"effect": "^3.10.6",
What steps can reproduce the bug?
Following docs, we can't create multiple failure schemas for middleware, although that should be the case. For instance, the authorization middleware should be able to return either
Unauthorized
ORInternalServerError
, for instance if something goes wrong with the DB query (db is down etc)What is the expected behavior?
It should be possible to define multiple
failure
schemas, since realistically middleware can have internal server errors, and the intended errors like Unauthorized etc.What do you see instead?
I can only provide one failure schema, which makes it so that if my DB is down, I still have to return
Unauthorized
with 401 status code which isn't correct. This makes it confusing to the user what went wrong. Also, we can't monitor for Internal Server Errors, since the middleware can return onlyUnauthorized
, even if something went horribly wrong.Additional information
No response