javarosa icon indicating copy to clipboard operation
javarosa copied to clipboard

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

Open lognaturel opened this issue 5 years ago • 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.

lognaturel avatar Mar 02 '20 17:03 lognaturel

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?

ggalmazor avatar Mar 02 '20 17:03 ggalmazor