Skip to content

Commit fc4d67b

Browse files
Merge pull request #1875 from wonza-hub/sync-c19
[문서] 10, 12 충돌 해결 및 미번역분 번역(C19)
2 parents 3848c55 + 054d069 commit fc4d67b

6 files changed

Lines changed: 125 additions & 550 deletions

File tree

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
차이점은 함수 내부의 코드를 보면 분명해집니다.
22

3-
<<<<<<< HEAD
43
`try..catch`에 '빠져나오게 하는' 코드가 있다면 함수의 행동이 달라집니다.
54

6-
아래 예시와 같이 `try..catch` 내부에 `return`이 있을 때가 대표적인 예입니다. `finally` 절은 `return`문을 통해 `try..catch`를 빠져나가는 경우를 포함하여 `try..catch`가 종료되는 *모든* 상황에서 실행됩니다. `try..catch`가 종료되었지만, 함수 호출 코드가 제어권을 갖기 직전에 실행되죠.
7-
=======
8-
The behavior is different if there's a "jump out" of `try...catch`.
9-
10-
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.
11-
>>>>>>> upstream/master
5+
아래 예시와 같이 `try..catch` 내부에 `return`이 있을 때가 대표적인 예입니다. `finally` 절은 `return`문을 통해 `try..catch`를 빠져나가는 경우를 포함하여 `try..catch`가 종료되는 _모든_ 상황에서 실행됩니다. `try..catch`가 종료되었지만, 함수 호출 코드가 제어권을 갖기 직전에 실행되죠.
126

137
```js run
148
function f() {
@@ -32,15 +26,9 @@ f(); // cleanup!
3226
```js run
3327
function f() {
3428
try {
35-
<<<<<<< HEAD
3629
alert('시작');
3730
throw new Error("에러 발생!");
38-
} catch (e) {
39-
=======
40-
alert('start');
41-
throw new Error("an error");
4231
} catch (err) {
43-
>>>>>>> upstream/master
4432
// ...
4533
if("에러를 핸들링 할 수 없다면") {
4634
*!*

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,26 @@ importance: 5
66

77
두 코드 조각을 비교해보세요.
88

9-
<<<<<<< HEAD
109
1. 첫 번째 코드 조각은 `try..catch` 이후에 코드를 실행하기 위해 `finally`를 사용하였습니다.
1110

1211
```js
1312
try {
1413
작업
1514
} catch (e) {
1615
에러 핸들링
17-
=======
18-
1. The first one uses `finally` to execute the code after `try...catch`:
19-
20-
```js
21-
try {
22-
work work
23-
} catch (err) {
24-
handle errors
25-
>>>>>>> upstream/master
2616
} finally {
2717
*!*
2818
작업 내역 삭제
2919
*/!*
3020
}
3121
```
32-
<<<<<<< HEAD
3322
2. 두 번째 코드 조각에선 `try..catch` 바로 아래에 작업 내역을 삭제하는 코드를 놓았습니다.
3423

3524
```js
3625
try {
3726
작업
3827
} catch (e) {
3928
에러 핸들링
40-
=======
41-
2. The second fragment puts the cleaning right after `try...catch`:
42-
43-
```js
44-
try {
45-
work work
46-
} catch (err) {
47-
handle errors
48-
>>>>>>> upstream/master
4929
}
5030
5131
*!*

0 commit comments

Comments
 (0)