-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Update ErrorHandling.rst #4099
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Update ErrorHandling.rst #4099
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -52,10 +52,10 @@ for developers to want to handle errors from different operations in | |
the same basic way, either by reporting the error to the user or | ||
passing the error back to their own clients. | ||
|
||
These errors will be the focus on this proposal. | ||
These errors will be the focus of this proposal. | ||
|
||
The final two classes of error are outside the scope of this proposal. | ||
A **universal error** is theoretically recoverable, but by its nature | ||
A **universal error** is theoretically recoverable, but by its nature, | ||
the language can't help the programmer anticipate where it will come | ||
from. A **logic failure** arises from a programmer mistake and should | ||
not be recoverable at all. In our system, these kinds of errors are | ||
|
@@ -305,7 +305,7 @@ generalized ``do`` statement:: | |
As with ``switch`` statements, Swift makes an effort to understand | ||
whether catch clauses are exhaustive. If it can determine it is, then | ||
the compiler considers the error to be handled. If not, the error | ||
automatically propagates out out of scope, either to a lexically | ||
automatically propagates out of scope, either to a lexically | ||
enclosing ``catch`` clause or out of the containing function (which must | ||
be marked ``throws``). | ||
|
||
|
@@ -327,7 +327,7 @@ the type:: | |
} | ||
|
||
The ``enum`` provides a namespace of errors, a list of possible errors | ||
within that namespace, and optional values to attach to each option. | ||
within that namespace and optional values to attach to each option. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep the oxford comma. |
||
|
||
Note that this corresponds very cleanly to the ``NSError`` model of an | ||
error domain, an error code, and optional user data. We expect to | ||
|
@@ -534,7 +534,7 @@ For other sentinel cases, we can consider adding a new clang attribute | |
to indicate to the compiler what the sentinel is: | ||
|
||
* There are several APIs returning ``NSInteger`` or ``NSUInteger``. At | ||
least some of these return 0 on error, but that doesn't seem like a | ||
least some of these return 0 on the error, but that doesn't seem like a | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extraneous. Please revert this. |
||
reasonable general assumption. | ||
|
||
* ``AVFoundation`` provides a couple methods returning | ||
|
@@ -691,7 +691,7 @@ can throw, and so it must also be marked with ``try``:: | |
} | ||
|
||
This marking feels redundant. We want functions like | ||
``autoreleasepool`` to feel like statements, but marks inside builtin | ||
``autoreleasepool`` to feel like statements, but marks inside built-in | ||
statements like ``if`` don't require the outer statement to be marked. | ||
It would be better if the compiler didn't require the outer ``try``. | ||
|
||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extraneous comma. If you wish to make the
but
parenthetical then move it there and reflow this sentence.