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

Ktorfit cant handle validation exceptions #646

Open
naixx opened this issue Aug 26, 2024 · 2 comments
Open

Ktorfit cant handle validation exceptions #646

naixx opened this issue Aug 26, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@naixx
Copy link

naixx commented Aug 26, 2024

Ktorfit version

2.0.0

What happened and how can we reproduce this issue?

Add custom validation to ktor

HttpResponseValidator {
            validateResponse {
                 throw MyHttpException()
            }
}

This exception is not propagated to coroutine suspension function.

try{
   myCoroutine()
catch(e: MyHttpException)

But if you throw any subtype of ResponseException, you will be able to catch it.

What did you expect to happen?

Any exception is propagated to coroutine

Is there anything else we need to know about?

No response

@naixx naixx added the bug Something isn't working label Aug 26, 2024
@Foso
Copy link
Owner

Foso commented Aug 26, 2024

It just tried to reproduce it, the exception is propagated to the catch block and then to the exceptionhandler

@naixx
Copy link
Author

naixx commented Aug 26, 2024

I suspect, it is not catched in catch as iI would expect, but in handler as you've mentioned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants