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

Add type parameter F[_] to DecodeFailureHandler. #3281

Merged
merged 4 commits into from
Nov 9, 2023

Conversation

Grryum
Copy link
Contributor

@Grryum Grryum commented Oct 29, 2023

Brings the same feature to DecodeFailureHandler like other interceptor handlers have.

@adamw
Copy link
Member

adamw commented Oct 29, 2023

Can you maybe share the use-case that motivated this change? Btw., you changed the signature of the DefaultDecodeFailureHandler, not DecodeFailureHandler

@Grryum
Copy link
Contributor Author

Grryum commented Oct 30, 2023

Can you maybe share the use-case that motivated this change?

sure, I would like to be able to prepare ValuedEndpointOutput[_] in every default handler interceptor (reject, exception, decodeFailure) within effect. I have some function with signature like this:
def makeFailedValuedEndpointOutput[F[_], ERROR_CTX](ctx: ERROR_CTX): F[ValuedEndpointOutput[MyErrorResponse]]
I can use it for RejectHandler[F[_]] and ExceptionHandler[F[_]] but not for DecodeFailureHandler.

Btw., you changed the signature of the DefaultDecodeFailureHandler, not DecodeFailureHandler

changes brings F[_] both to DecodeFailureHandler[F[_]] and DefaultDecodeFailureHandler[F[_]] - align signatures with other handlers

@Grryum Grryum force-pushed the decode-failure-handler-tf branch from bdcb465 to 82aeef5 Compare October 30, 2023 17:43
@jnicoulaud-ledger
Copy link
Contributor

+1, we have same use case. We use it to add common structure/fields to all errors in our application, some fields are constant but some require effects (such as getting the current trace id in our case).

@kciesielski kciesielski merged commit 52bcd33 into softwaremill:master Nov 9, 2023
10 checks passed
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

Successfully merging this pull request may close these issues.

4 participants