Skip to content

Commit 43fc898

Browse files
committed
add url to network error
1 parent 425f341 commit 43fc898

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Coder Desktop/VPNLib/Download.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public func download(src: URL, dest: URL, urlSession: URLSession) async throws(D
116116
do {
117117
(tempURL, response) = try await urlSession.download(for: req)
118118
} catch {
119-
throw .networkError(error)
119+
throw .networkError(error, url: src.absoluteString)
120120
}
121121
defer {
122122
if FileManager.default.fileExists(atPath: tempURL.path) {
@@ -155,15 +155,15 @@ func etag(data: Data) -> String {
155155
public enum DownloadError: Error {
156156
case unexpectedStatusCode(Int)
157157
case invalidResponse
158-
case networkError(any Error)
158+
case networkError(any Error, url: String)
159159
case fileOpError(any Error)
160160

161161
public var description: String {
162162
switch self {
163163
case let .unexpectedStatusCode(code):
164164
"Unexpected HTTP status code: \(code)"
165-
case let .networkError(error):
166-
"Network error: \(error.localizedDescription)"
165+
case let .networkError(error, url):
166+
"Network error: \(url) - \(error.localizedDescription)"
167167
case let .fileOpError(error):
168168
"File operation error: \(error.localizedDescription)"
169169
case .invalidResponse:

0 commit comments

Comments
 (0)