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
When I send a request to this api, I receive a 500 Server Error instead of the 409 Conflict because this piece of code in zio-http fails with a java.util.NoSuchElementException: None.get exception:
It doesn't seem that we're able to define an error response with a body in zio-http.
The only function I see to define an error response is Response.fromHttpError(HttpError.Conflict) but it doesn't allow us to pass a body while the ErrorResponse type does take a body:
Am I missing something?
Shouldn't we be able to define any response type with the Response.apply constructor? 🤔
Edit:
After futher investigation, it seems that this issue comes from the beautifyErrors middleware.
When I remove it, my API is correctly answering 409 Conflict
The text was updated successfully, but these errors were encountered:
guizmaii
changed the title
Defining a 409 Response with a body leads to a java.util.NoSuchElementException: None.get exceptionbeautifyErrors middleware bug: Defining a 409 Response with a body leads to a java.util.NoSuchElementException: None.get exception
Jul 14, 2023
Hey 🙂
I have an API defined this way:
and a handler for the errors:
so that in my main object, I have:
When I send a request to this
api
, I receive a500 Server Error
instead of the409 Conflict
because this piece of code in zio-http fails with ajava.util.NoSuchElementException: None.get
exception:It doesn't seem that we're able to define an error response with a body in zio-http.
The only function I see to define an error response is
Response.fromHttpError(HttpError.Conflict)
but it doesn't allow us to pass a body while theErrorResponse
type does take a body:Am I missing something?
Shouldn't we be able to define any response type with the
Response.apply
constructor? 🤔Edit:
After futher investigation, it seems that this issue comes from the
beautifyErrors
middleware.When I remove it, my API is correctly answering
409 Conflict
The text was updated successfully, but these errors were encountered: