Skip to content

Commit 7e9c243

Browse files
committed
Foundation: map ECANCELED properly for Windows
This is generally not a very helpful constant for Windows, however, it can be passed from Dispatch in some cases. Lets just provide the mapping for the Windows version.
1 parent 3eda66b commit 7e9c243

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Sources/Foundation/NSError.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,14 @@ extension POSIXErrorCode: _ErrorCodeProtocol {
995995
public typealias _ErrorType = POSIXError
996996
}
997997

998+
#if os(Windows)
999+
extension POSIXErrorCode {
1000+
public static var ECANCELED: POSIXErrorCode {
1001+
return POSIXError.Code(rawValue: WinSDK.ECANCELED)!
1002+
}
1003+
}
1004+
#endif
1005+
9981006
extension POSIXError {
9991007
/// Operation not permitted.
10001008
public static var EPERM: POSIXError.Code { return .EPERM }
@@ -1313,10 +1321,10 @@ extension POSIXError {
13131321
public static var EBADMACHO: POSIXError.Code { return .EBADMACHO }
13141322
#endif
13151323

1316-
#if !os(Windows)
13171324
/// Operation canceled.
13181325
public static var ECANCELED: POSIXError.Code { return .ECANCELED }
13191326

1327+
#if !os(Windows)
13201328
/// Identifier removed.
13211329
public static var EIDRM: POSIXError.Code { return .EIDRM }
13221330

0 commit comments

Comments
 (0)