Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

Error Handling on Android Vasilis Charalampakis Android Software Engineer @ Workable [email protected] Pavlos-Petros Tournaris Android Software Engineer @ Workable [email protected]

Slide 3

Slide 3 text

A common problem in Software

Slide 4

Slide 4 text

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.

Slide 5

Slide 5 text

Global VS Specific Global Handle an error in a common way Specific Handle an error specifically for a screen

Slide 6

Slide 6 text

Approach

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

API ● Initialize ● Configure ● Execute

Slide 9

Slide 9 text

Initialize ● defaultErrorHandler() ● create() ● createIsolated()

Slide 10

Slide 10 text

Configure ● on(T, Action) ● on(Class, Action) ● clear() ● bindErrorCode(T, MatcherFactory) ● bindErrorCodeClass(Class, MatcherFactory)

Slide 11

Slide 11 text

Configure ● skipFollowing() ● skipAlways() ● skipDefaults() ● always(Action) ● otherwise(Action)

Slide 12

Slide 12 text

Execute ● handle(throwable); ● run(() -> foo()); // Coming soon…

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

Thanks!