Skip to content

Commit

Permalink
Merge pull request swiftlang#4611 from compnerd/error
Browse files Browse the repository at this point in the history
Foundation: rework handling for `ECANCELED`
  • Loading branch information
compnerd authored Jul 9, 2022
2 parents 0b5e0ea + 4858113 commit bbcf916
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions Sources/Foundation/NSError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -995,14 +995,6 @@ extension POSIXErrorCode: _ErrorCodeProtocol {
public typealias _ErrorType = POSIXError
}

#if os(Windows)
extension POSIXErrorCode {
public static var ECANCELED: POSIXErrorCode {
return POSIXError.Code(rawValue: WinSDK.ECANCELED)!
}
}
#endif

extension POSIXError {
/// Operation not permitted.
public static var EPERM: POSIXError.Code { return .EPERM }
Expand Down Expand Up @@ -1322,7 +1314,13 @@ extension POSIXError {
#endif

/// Operation canceled.
public static var ECANCELED: POSIXError.Code { return .ECANCELED }
public static var ECANCELED: POSIXError.Code {
#if os(Windows)
return POSIXError.Code(rawValue: ERROR_CANCELLED)!
#else
return .ECANCELED
#endif
}

#if !os(Windows)
/// Identifier removed.
Expand Down

0 comments on commit bbcf916

Please sign in to comment.