Throw new InterruptedIOException subtype on timeout#697
Throw new InterruptedIOException subtype on timeout#697dmgd wants to merge 4 commits intosquare:masterfrom
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.