Skip to content

Commit 4e94434

Browse files
committed
Answer a common question/misconception
1 parent 318e2ba commit 4e94434

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

TSPL.docc/LanguageGuide/TheBasics.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1829,6 +1829,15 @@ so Swift also provides unsafe versions of some APIs.
18291829
When you use types or methods whose name includes the word "unsafe",
18301830
you take on the responsibility for safety.
18311831

1832+
Safe code in Swift can still encounter errors and unexpected failures,
1833+
which might stop the program's execution.
1834+
Safety makes no guarantee about whether your code runs to completion.
1835+
Swift provides several ways to indicate and recover from errors,
1836+
discussed in <doc:TheBasics#Error-Handling>
1837+
and <doc:TheBasics#Assertions-and-Preconditions> below.
1838+
However, in some cases,
1839+
the *only* safe way to handle an error is to stop execution.
1840+
18321841
## Error Handling
18331842

18341843
You use *error handling* to respond to error conditions

0 commit comments

Comments
 (0)