Skip to content

Commit 7718f10

Browse files
committed
[SE-0112] Make userInfo accessible via [String : AnyObject] on imported NSErrors.
1 parent 7b141ff commit 7718f10

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

stdlib/public/SDK/Foundation/NSError.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,10 @@ public extension _BridgedStoredNSError
400400
code: numericCast(code.rawValue),
401401
userInfo: userInfo))
402402
}
403+
404+
/// The user-info dictionary for an error that was bridged from
405+
/// NSError.
406+
var userInfo: [String : AnyObject] { return errorUserInfo }
403407
}
404408

405409
/// Various helper implementations for _BridgedStoredNSError

test/1_stdlib/ErrorBridged.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ ErrorBridgingTests.test("NSError-to-enum bridging") {
177177
case let error as CLError:
178178
isCLError = true
179179
expectOptionalEqual(testURL, (error as NSError).userInfo[NSURLErrorKey] as? URL)
180+
expectOptionalEqual(testURL, error.userInfo[NSURLErrorKey] as? URL)
180181
default:
181182
isCLError = false
182183
}

0 commit comments

Comments
 (0)