Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7ad529e

Browse files
authored
Merge pull request #2464 from VibingCreator/master
Unify content with cosmetic changes
2 parents 8bc505a + ad01279 commit 7ad529e

File tree

3 files changed

+76
-76
lines changed

3 files changed

+76
-76
lines changed

‎1-js/10-error-handling/1-try-catch/1-finally-or-code-after/solution.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
The difference becomes obvious when we look at the code inside a function.
22

3-
The behavior is different if there's a "jump out" of `try..catch`.
3+
The behavior is different if there's a "jump out" of `try...catch`.
44

5-
For instance, when there's a `return` inside `try..catch`. The `finally` clause works in case of *any* exit from `try..catch`, even via the `return` statement: right after `try..catch` is done, but before the calling code gets the control.
5+
For instance, when there's a `return` inside `try...catch`. The `finally` clause works in case of *any* exit from `try...catch`, even via the `return` statement: right after `try...catch` is done, but before the calling code gets the control.
66

77
```js run
88
function f() {
@@ -11,7 +11,7 @@ function f() {
1111
*!*
1212
return "result";
1313
*/!*
14-
} catch (e) {
14+
} catch (err) {
1515
/// ...
1616
} finally {
1717
alert('cleanup!');
@@ -28,11 +28,11 @@ function f() {
2828
try {
2929
alert('start');
3030
throw new Error("an error");
31-
} catch (e) {
31+
} catch (err) {
3232
// ...
3333
if("can't handle the error") {
3434
*!*
35-
throw e;
35+
throw err;
3636
*/!*
3737
}
3838

‎1-js/10-error-handling/1-try-catch/1-finally-or-code-after/task.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ importance: 5
66

77
Compare the two code fragments.
88

9-
1. The first one uses `finally` to execute the code after `try..catch`:
9+
1. The first one uses `finally` to execute the code after `try...catch`:
1010

1111
```js
1212
try {
1313
work work
14-
} catch (e) {
14+
} catch (err) {
1515
handle errors
1616
} finally {
1717
*!*
1818
cleanup the working space
1919
*/!*
2020
}
2121
```
22-
2. The second fragment puts the cleaning right after `try..catch`:
22+
2. The second fragment puts the cleaning right after `try...catch`:
2323

2424
```js
2525
try {
2626
work work
27-
} catch (e) {
27+
} catch (err) {
2828
handle errors
2929
}
3030

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /