There are consumers of java.io.IOException that have reason to want to know the underlying condition which caused the exception. For example, see the JRuby code
https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/Ruby.java#L3964...L3996
One way to encode such information would be with subtypes of IOException. However, exception types should be declared sparingly (https://blogs.oracle.com/darcy/entry/design_tips_exception_types), so a "getProblem" method or similar might be a better approach. The problem could be an enum or a wrapper around errno.
Design complications includes the many subtypes of IOException and serialization.
https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/Ruby.java#L3964...L3996
One way to encode such information would be with subtypes of IOException. However, exception types should be declared sparingly (https://blogs.oracle.com/darcy/entry/design_tips_exception_types), so a "getProblem" method or similar might be a better approach. The problem could be an enum or a wrapper around errno.
Design complications includes the many subtypes of IOException and serialization.
- relates to
-
JDK-8167161 Add a public Exception type for Connection Reset
-
- Open
-