Skip to content

Commit a912a12

Browse files
kandelvijayanatecook1000
authored andcommitted
Update ErrorType.swift documentation on IntParsingError (#16092)
Update ErrorType.swift Example on IntParsingError should have Character as associated value type not String. Also updated sample code to use c rather than s
1 parent bfda039 commit a912a12

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

stdlib/public/core/ErrorType.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import SwiftShims
3535
///
3636
/// enum IntParsingError: Error {
3737
/// case overflow
38-
/// case invalidInput(String)
38+
/// case invalidInput(Character)
3939
/// }
4040
///
4141
/// The `invalidInput` case includes the invalid character as an associated
@@ -48,8 +48,9 @@ import SwiftShims
4848
/// extension Int {
4949
/// init(validating input: String) throws {
5050
/// // ...
51-
/// if !_isValid(s) {
52-
/// throw IntParsingError.invalidInput(s)
51+
/// let c = _nextCharacter(from: input)
52+
/// if !_isValid(c) {
53+
/// throw IntParsingError.invalidInput(c)
5354
/// }
5455
/// // ...
5556
/// }

0 commit comments

Comments
 (0)