Skip to content

Commit e59fdbe

Browse files
code
1 parent e8f5e30 commit e59fdbe

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

README.md

+1-7
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ On the other hand, the `catch {}` block **is** genuine control flow, making its
5959

6060
> a person or thing that is excluded from a general statement or does not follow a rule.
6161
62-
Since `catch` is explicitly handling exceptions, it makes sense to encapsulate exception-handling logic in a block that separates it from the normal program flow.
63-
64-
<br />
62+
Since `catch` is explicitly handling exceptions, it makes sense to encapsulate exception-handling logic in a block that separates it. Following the same line of thought, there is no logical reason to also encapsulate the non-exceptional flow in a block.
6563

6664
Consider a simple function like this:
6765

@@ -76,8 +74,6 @@ function getPostInfo(session, postSlug, cache, db) {
7674
}
7775
```
7876

79-
<br />
80-
8177
But **production code is rarely this clean**. Error handling quickly forces a messier structure:
8278

8379
```js
@@ -118,8 +114,6 @@ The `try` blocks didn't provide much value beyond introducing unnecessary nestin
118114

119115
Instead, using the proposed `try` operator simplifies the function:
120116

121-
<br />
122-
123117
```js
124118
function getPostInfo(session, postId, cache, db) {
125119
const [userOk, userErr, user] = try cache.getUser(session.userId)

0 commit comments

Comments
 (0)