-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Throw new InterruptedIOException subtype on timeout #697
base: master
Are you sure you want to change the base?
Conversation
Introduces TimeoutException which a caller can catch if it just wants to just deal with timeout and deadline reached, but not interrupts.
The specific case I'm dealing with is something that wants to transform timeouts into an http response, but leave interrupts alone. It could do this by catching InterruptedIOException and then working out whether it's a timeout or not + rethrowing if it's not, but this change would make the handling code much cleaner |
Unfortunately you’re competing with Introducing our own timeout exception feels like a complicated feature that we’d need to do everywhere, including significant tests in Okio and OkHttp. |
Good point about In terms of backwards compatibility, |
I definitely like subtyping |
So I think what I've just pushed might be everywhere that's relevant in okio (based on searches for I'm taking a look at OkHttp now :) |
dmgd/okhttp@71fa6b5 |
Introduces TimeoutException which a caller can catch if it just wants to just deal with timeout and deadline reached, but not interrupts.