Skip to content

Commit 9e5188e

Browse files
committed
Update Readme
1 parent d2c8b64 commit 9e5188e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,12 @@ ErrorHandler is __thread-safe__.
185185

186186
When designing for errors, we usually need to:
187187

188-
1. have a **default** handler for every **expected** error (i.e. network, subscription errors)
189-
2. handle **specific** errors **as appropriate** based on where and when they occur (i.e. network error while uploading a file, invalid login)
190-
3. have a **catch-all** handler for **unknown** errors (i.e. system libraries runtime errors we don't anticipate)
188+
1. have a **default** handler for every **expected** error
189+
// i.e. network, subscription errors
190+
2. handle **specific** errors **as appropriate** based on where and when they occur
191+
// i.e. network error while uploading a file, invalid login
192+
3. have a **catch-all** handler for **unknown** errors
193+
// i.e. system libraries runtime errors we don't anticipate
191194
4. keep our code **DRY**
192195

193196
Java, as a language, provides you with a way to do the above. By mapping cross-cutting errors to runtime exceptions and catching them lower in the call stack, while having specific expected errors mapped to checked exceptions and handle them near where the error occurred. Still, countless are the projects where this simple strategy has gone astray with lots of errors being either swallowed or left for the catch-all `Thread.UncaughtExceptionHandler`. Moreover, it usually comes with significant boilerplate code. `ErrorHandler` however eases this practice through its fluent API, error aliases and defaults mechanism.

0 commit comments

Comments
 (0)