Skip to content

Instantly share code, notes, and snippets.

@pavlospt
Created September 9, 2016 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavlospt/82d97bd85df38b659ce85b4b33a39a47 to your computer and use it in GitHub Desktop.
Save pavlospt/82d97bd85df38b659ce85b4b33a39a47 to your computer and use it in GitHub Desktop.
ErrorHandler's API - Configuration
ErrorHandler
.defaultErrorHandler()
.bindErrorCodeClass(Integer.class, RetrofitMatcherFactory.create())
.bindErrorCodeClass(Range.class, RetrofitMatcherFactory.createRange())
.on(400, (throwable, errorHandler) -> showErrorMessage("what?"))
.on(Range.of(500, 599), (throwable, errorHandler) -> showErrorMessage("kaboom"))
.handle(httpException);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment