- Notifications
You must be signed in to change notification settings - Fork179
Error handling, "try...catch"#225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
16 commits Select commitHold shift + click to select a range
b44acfa
Initial changes
Purusah85cf52b
Next step translated
Purusah488e6d2
Improvments
Purusahbd91071
Images translated
Purusah992ff4a
Almost the end
Purusahef9a300
Finalization
Purusah75f5447
Clean up
Purusahe494e21
Fix image translation
Purusahe5731a7
Task name translation
Purusah7113dd3
Typo fixes
Purusahde26d2f
More typo fixes
Purusahe6d83ff
Merge pull request #1 from Purusah/translate/try-catch-flow
Purusahacdc7a0
Added review fixes
Purusah180fd3b
Adjust word order to general style
Purusah1c657e3
Merge pull request #2 from Purusah/translate/try-catch-flow
Purusahe267ed2
Small fixes
tarasyyykFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
28 changes: 14 additions & 14 deletions1-js/10-error-handling/1-try-catch/1-finally-or-code-after/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
Різниця стає очевидною, якщо ми подивимося на код всередині функції. | ||
Поведінка відрізнятиметься, якщо код «раптово вийде» з блоку `try...catch`. | ||
Наприклад, якщо всередині `try...catch` є `return`. Блок `finally`спрацює для "будь-якого" виходу з`try...catch`,навіть за допомогою `return`-- одразу після виходу з блоку`try...catch`, але перед передачею контролю кодові, що викликав цю функцію. | ||
```js run | ||
function f() { | ||
try { | ||
alert('початок'); | ||
*!* | ||
return "результат"; | ||
*/!* | ||
} catch (err) { | ||
/// ... | ||
} finally { | ||
alert('очищення!'); | ||
} | ||
} | ||
f(); //очищення! | ||
``` | ||
...Або якщо є`throw`: | ||
```js run | ||
function f() { | ||
try { | ||
alert('початок'); | ||
throw new Error("помилка"); | ||
} catch (err) { | ||
// ... | ||
if("не можу обробити помилку") { | ||
*!* | ||
throw err; | ||
*/!* | ||
} | ||
} finally { | ||
alert('очищення!') | ||
} | ||
} | ||
f(); //очищення! | ||
``` | ||
`finally`гарантує очищення. Очищення не спрацює, якщо ми просто додамо код в кінці функції`f`. |
24 changes: 12 additions & 12 deletions1-js/10-error-handling/1-try-catch/1-finally-or-code-after/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.