diff --git a/Sources/SwiftAPIClient/APIClientCaller.swift b/Sources/SwiftAPIClient/APIClientCaller.swift index 7c6e6d2..269c1e6 100644 --- a/Sources/SwiftAPIClient/APIClientCaller.swift +++ b/Sources/SwiftAPIClient/APIClientCaller.swift @@ -243,6 +243,7 @@ public extension APIClient { } catch { try withConfigs { configs in let fileIDLine = configs.fileIDLine ?? FileIDLine(fileID: fileID, line: line) + let configs = configs.with(\.fileIDLine, fileIDLine) if !configs._errorLoggingComponents.isEmpty { let message = configs._errorLoggingComponents.errorMessage( uuid: uuid, diff --git a/Sources/SwiftAPIClient/Clients/HTTPClient.swift b/Sources/SwiftAPIClient/Clients/HTTPClient.swift index 187af6a..73bc2a1 100644 --- a/Sources/SwiftAPIClient/Clients/HTTPClient.swift +++ b/Sources/SwiftAPIClient/Clients/HTTPClient.swift @@ -134,6 +134,7 @@ extension APIClientCaller where Result == AsyncThrowingValue<(Value, HTTPRespons if configs.reportMetrics { updateHTTPMetrics(for: request, status: nil, duration: duration, successful: false) } + try configs.errorHandler(error, configs, APIErrorContext(request: request, fileIDLine: configs.fileIDLine ?? FileIDLine())) throw error } let duration = Date().timeIntervalSince(start)