Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effectful handling of decoding failures #578

Closed
ybasket opened this issue May 12, 2020 · 2 comments
Closed

Effectful handling of decoding failures #578

ybasket opened this issue May 12, 2020 · 2 comments

Comments

@ybasket
Copy link

ybasket commented May 12, 2020

From https://gitter.im/softwaremill/tapir?at=5ea043bedc6ae2132b427277

Currently, the DecodeFailureHandler requires the handling function to be pure. This makes principled logging of bad requests (wrapped in some effect type) impossible or at least ugly (unsafeRunSync and similar).

To fix this, the DecodeFailureHandling could be extended with one more case to allow responding with a response wrapped in an effect. Alternatively, DecoderFailureHandler could be changed to DecodeFailureContext => F[DecodeFailureHandling] for some type param F[_].

@aeons
Copy link
Contributor

aeons commented Feb 2, 2021

This would be very nice to have. It would be nice to be able to log a message, since the decode error messages can be quite opaque.

@adamw
Copy link
Member

adamw commented Mar 31, 2021

This should be possible with 0.18.0-M1, and a custom interceptor, used instead of the default one. See https://tapir.softwaremill.com/en/latest/server/options.html for details.

@adamw adamw closed this as completed Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants