Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cr3ativ3 opened this issue Mar 22, 2018 · 0 comments
Open

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

cr3ativ3 opened this issue Mar 22, 2018 · 0 comments

Comments

@cr3ativ3
Copy link
Contributor

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());
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants