Error handling on Android - 1st Android Athens Meetup

Error handling on Android - 1st Android Athens Meetup

B0e9ea3077f68ec3cb01b4499062c89e?s=128

Pavlos-Petros Tournaris

September 22, 2016
Tweet

Transcript

  1. Error Handling Efficient error handling on Android https://github.com/Workable/java-error-handler

  2. Error Handling on Android Vasilis Charalampakis Android Software Engineer @

    Workable basilis@workable.com Pavlos-Petros Tournaris Android Software Engineer @ Workable tournaris@workable.com
  3. A common problem in Software

  4. 1. Have a default handler for every expected (exceptional, common

    or not) error. 2. Handle specific errors as appropriate based on where and when they occur. 3. Have a default catch-all handler for unknown errors. 4. Override any default handler if needed. 5. Keep our code DRY.
  5. Global VS Specific Global Handle an error in a common

    way Specific Handle an error specifically for a screen
  6. Approach

  7. Solution https://github.com/Workable/java-error-handler

  8. API • Initialize • Configure • Execute

  9. Initialize • defaultErrorHandler() • create() • createIsolated()

  10. Configure • on(T, Action) • on(Class<? extends Exception>, Action) •

    clear() • bindErrorCode(T, MatcherFactory<T>) • bindErrorCodeClass(Class<T>, MatcherFactory<T>)
  11. Configure • skipFollowing() • skipAlways() • skipDefaults() • always(Action) •

    otherwise(Action)
  12. Execute • handle(throwable); • run(() -> foo()); // Coming soon…

  13. DEMO https://github.com/pavlospt/error-handler-demo

  14. Thanks!