Skip to content

Jspoon's exception model is cluttered and not very usefull #58

Description

@cr3ativ3

All jspoon's conversion exceptions extend too broad RuntimeException and provide only the error message with no information about what field or class caused it.

For example, if you use Jspoon together with Retrofit2 like I do, and want to somehow handle converter exception you have to check for 6 different exception types in onFailure()

@Override
public void onFailure(Call<MyAwesomeRepo> call, Throwable t) {  

    if ((t instanceof NumberFormatException) || (t instanceof DateParseException) 
        || (t instanceof BigDecimalParseException) || (t instanceof DoubleParseException)
        || (t instanceof FloatParseException) || (t instanceof FieldSetException)) {
        
        // all I can do is only log the original message anyway
        logger.error(e.getMessage());
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions