File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 1+ # Unreleased
2+ - [ added] Provide server errors via the ` NSUnderlyingErrorKey ` .
3+
14# 10.5.0
25- [ added] Added Storage API to limit upload chunk size. (#10137 )
36- [ fixed] Run ` pod update ` or ` File -> Packages -> Update to latest Packages ` to update the ` GTMSessionFetcher ` dependency to at least version ` 3.1.0 ` .
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ public let StorageErrorDomain: String = "FIRStorageErrorDomain"
5858 errorDictionary [ " ResponseErrorDomain " ] = serverError. domain
5959 errorDictionary [ " ResponseErrorCode " ] = serverError. code
6060 errorDictionary [ " bucket " ] = ref. path. bucket
61+ errorDictionary [ NSUnderlyingErrorKey] = serverError
6162
6263 if let object = ref. path. object {
6364 errorDictionary [ " object " ] = object
Original file line number Diff line number Diff line change @@ -55,7 +55,12 @@ import XCTest
5555 _ = try await ref. delete ( )
5656 } catch {
5757 caughtError = true
58- XCTAssertEqual ( ( error as NSError ) . code, StorageErrorCode . objectNotFound. rawValue)
58+ let nsError = error as NSError
59+ XCTAssertEqual ( nsError. code, StorageErrorCode . objectNotFound. rawValue)
60+ XCTAssertEqual ( nsError. userInfo [ " ResponseErrorCode " ] as? Int , 404 )
61+ let underlyingError = try XCTUnwrap ( nsError. userInfo [ NSUnderlyingErrorKey] as? NSError )
62+ XCTAssertEqual ( underlyingError. code, 404 )
63+ XCTAssertEqual ( underlyingError. domain, " com.google.HTTPStatus " )
5964 }
6065 XCTAssertTrue ( caughtError)
6166 }
@@ -132,8 +137,11 @@ import XCTest
132137 do {
133138 _ = try await ref. putFileAsync ( from: fileURL)
134139 XCTFail ( " Unexpected success from putFile of a directory " )
135- } catch StorageError . unknown {
136- XCTAssertTrue ( true )
140+ } catch let StorageError . unknown( reason) {
141+ XCTAssertTrue ( reason. starts ( with: " File at URL: " ) )
142+ XCTAssertTrue ( reason. hasSuffix (
143+ " is not reachable. Ensure file URL is not a directory, symbolic link, or invalid url. "
144+ ) )
137145 } catch {
138146 XCTFail ( " error failed to convert to StorageError.unknown " )
139147 }
You can’t perform that action at this time.
0 commit comments