Skip to content

Commit 6e0ea8b

Browse files
committed
on API request network error, give the original URL if there is not a URL specifically associated with the error.
1 parent f4de144 commit 6e0ea8b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Sources/JSONAPISwiftGen/Swift Generators/Test Generators/APIRequestTestSwiftGen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ func makeTestRequest<RequestBody>(
317317
318318
let taskCompletion = { (data: Data?, response: URLResponse?, error: Error?) in
319319
if let error = error as? URLError {
320-
let urlString = error.failureURLString.map { " \($0)" } ?? ""
320+
let urlString = error.failureURLString.map { " \($0)" } ?? " originally requested: \(requestUrl.absoluteString)"
321321
XCTFail("\(error.localizedDescription) (\(error.code.rawValue))\(urlString)")
322322
return
323323
}

Tests/JSONAPISwiftGenTests/APIRequestTestSwiftGenTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func makeTestRequest<RequestBody>(
128128

129129
let taskCompletion = { (data: Data?, response: URLResponse?, error: Error?) in
130130
if let error = error as? URLError {
131-
let urlString = error.failureURLString.map { " \($0)" } ?? ""
131+
let urlString = error.failureURLString.map { " \($0)" } ?? " originally requested: \(requestUrl.absoluteString)"
132132
XCTFail("\(error.localizedDescription) (\(error.code.rawValue))\(urlString)")
133133
return
134134
}

0 commit comments

Comments
 (0)