You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-21Lines changed: 19 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2327,16 +2327,14 @@ try {
2327
2327
2328
2328
## μλ¬ μ²λ¦¬
2329
2329
2330
-
Thrown errors are a good thing! They mean the runtime has successfully identified when something in your program has gone wrong and it's letting you know by stopping function
2331
-
execution on the current stack, killing the process (in Node), and notifying you in the console with a stack trace.
@@ -2388,13 +2386,13 @@ function calculateTotal(items: Item[]): Failable<number, 'empty'> {
2388
2386
}
2389
2387
```
2390
2388
2391
-
For the detailed explanation of this idea refer to the [original post](https://medium.com/@dhruvrajvanshi/making-exceptions-type-safe-in-typescript-c4d200ee78e9).
Doing nothing with a caught error doesn't give you the ability to ever fix or react to said error. Logging the error to the console (`console.log`) isn't much better as often times it can get lost in a sea of things printed to the console. If you wrap any bit of code in a `try/catch` it means you think an error may occur there and therefore you should have a plan, or create a code path, for when it occurs.
0 commit comments