Skip to content

Commit 2c76c69

Browse files
authored
Update README.md
1 parent 1e58b10 commit 2c76c69

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/pages/error-handling/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Both languages pass errors as regular values. Also, both languages leverage flow
77
Despite the similarity claimed above, the languages differ on how and when errors are handled:
88

99
**JS**
10+
1011
In JS, the way to propagate an error is determined by the synchronous or asynchronous nature of the function.
1112
If a function is synchronous, then it should use `throw` when an error occurs, and the caller should use `try/catch` blocks.
1213

@@ -15,6 +16,7 @@ Otherwise, an asynchronous function should propagate the error by passing it as
1516
Note the `async/await` mechanism, which is in draft, will consolidate both worlds by having asynchronous errors being handled inside `try/catch` blocks.
1617

1718
**Go**
19+
1820
In Go on the other hand, the way to propagate an error is determined by the degree of severity with context of the whole application.
1921

2022
For example, for a web-server application, if errors occur in a request handling code path, they should not crash the entire server. Therefore, these errors should be returned as a last argument to the caller.

0 commit comments

Comments
 (0)