Failed outputs are rendered as responses with no body
See original GitHub issueI’m trying to upgrade to 0.14 (from 0.11), and I’m encountering an issue with custom error responses. I am using finch-circe, and I have a custom Encoder[Exception]
which is imported into the implicit scope where I’m calling toServiceAs
, but I don’t see my custom output. Also, logging that I injected into my encoder never fires, which further indicates that my code is not getting run.
I see responses that look like:
HTTP/1.1 400 Bad Request
Content-Length: 0
Date: Fri, 21 Apr 2017 18:05:39 GMT
Vary: Origin
@vkostyukov notes that the date header means Finch is processing the response, because finagle by itself doesn’t have that. However, even if there was no message, the default Encoder[Exception]
instance would seem to return "{message:null}"
in the body, in the event of a missing message. It’s not clear why the bodies are missing entirely.
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (1 by maintainers)
Top GitHub Comments
Hi @anatoliykmetyuk, it looks the rendering of the docs is a little messed up, but if you look at the bottom of this section, it shows that you can do this:
I’ll try to fix those up later so its clearer how to render errors.
Note that https://finagle.github.io/finch/user-guide.html#errors (that @rpless referenced above) contains a much more elaborated code snippet now than the comment above.