getodk/javarosa

Overly generic exception types make it hard for clients to do error handling

lognaturel opened this issue · 1 comments

There are a number of places where JavaRosa throws RuntimeExceptions. That can make it hard for clients to differentiate between exceptions that came from JavaRosa and exceptions that came from elsewhere. As a result, Collect does awkward things like catch RuntimeExceptions and wrap them in its own JavaRosaException type: https://github.com/opendatakit/collect/blob/master/collect_app/src/main/java/org/odk/collect/android/logic/FormController.java#L626

Throwing JavaRosa-specific subtypes of RuntimeException would help make those exceptions easier to reason about.

CC @seadowg who brought up this awkwardness on the Collect end of things.

This sounds reasonable. Thanks for bringing it up! :)

Maybe we could start focusing on the specific places where Collect is forced to catch RuntimeExceptions. Do we have a list of those?