Use IOException
provided by kotlinx-io
#728
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change comes with some tradeoffs:
One one hand, we get to leverage a widely used class signature for
IOException
, that consumers may already use — reducing overhead of having to keep Kable's (com.juul.kable.IOException
) vs. kotlinx-io's (kotlinx.io.IOException
) separate. In other words: it is a footgun for consumers that use kotlinx-io, as they may try to catchkotlinx.io.IOException
when calling a Kable IO function (not realizing thatcom.juul.kable.IOException
will slip right through thattry
-catch
).On the other hand, this pulls in a library purely for a single exception class (this would likely be justified if we started adding support for kotlinx-io features, e.g.
Source
,Sink
,Buffer
; but that is a long ways off, if ever).Of further consideration: there is talk of moving some of these IO primitives to the standard library (Kotlin/kotlinx-io#354). It is unclear if that would include
IOException
— ifIOException
were moved to the standard library it would be a no brainer to use it.