Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Error handling on Android - 1st Android Athens Meetup
Pavlos-Petros Tournaris
September 22, 2016
Technology
0
120
Error handling on Android - 1st Android Athens Meetup
Pavlos-Petros Tournaris
September 22, 2016
Tweet
Share
Other Decks in Technology
See All in Technology
armaniacs
0
310
robcrowley
1
450
korodroid
0
230
hmatsu47
5
730
mahito
0
240
uzabasetech
2
750
tnmt
3
260
ks91
PRO
0
140
dena_tech
0
220
piazza
0
130
ippey
2
210
ryomasumura
0
120
Featured
See All Featured
caitiem20
308
17k
tanoku
258
24k
edds
56
9.4k
robhawkes
52
2.8k
jakevdp
775
200k
stephaniewalter
260
11k
marcelosomers
221
15k
lauravandoore
10
1.6k
pauljervisheath
195
15k
marktimemedia
7
400
philnash
9
590
revolveconf
200
9.7k
Transcript
Error Handling Efficient error handling on Android https://github.com/Workable/java-error-handler
Error Handling on Android Vasilis Charalampakis Android Software Engineer @
Workable basilis@workable.com Pavlos-Petros Tournaris Android Software Engineer @ Workable tournaris@workable.com
A common problem in Software
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.
Global VS Specific Global Handle an error in a common
way Specific Handle an error specifically for a screen
Approach
Solution https://github.com/Workable/java-error-handler
API • Initialize • Configure • Execute
Initialize • defaultErrorHandler() • create() • createIsolated()
Configure • on(T, Action) • on(Class<? extends Exception>, Action) •
clear() • bindErrorCode(T, MatcherFactory<T>) • bindErrorCodeClass(Class<T>, MatcherFactory<T>)
Configure • skipFollowing() • skipAlways() • skipDefaults() • always(Action) •
otherwise(Action)
Execute • handle(throwable); • run(() -> foo()); // Coming soon…
DEMO https://github.com/pavlospt/error-handler-demo
Thanks!