From 9e6a06c7104df5dd2ebfd00390b040b0d018d422 Mon Sep 17 00:00:00 2001 From: pjechris Date: Sun, 22 May 2022 13:45:30 +0200 Subject: [PATCH] [session] log after tryCatch (#6) --- Sources/SimpleHTTP/Session/Session.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/SimpleHTTP/Session/Session.swift b/Sources/SimpleHTTP/Session/Session.swift index 9361b66..72e9119 100644 --- a/Sources/SimpleHTTP/Session/Session.swift +++ b/Sources/SimpleHTTP/Session/Session.swift @@ -74,17 +74,17 @@ public class Session { extension Session { private func dataPublisher(for request: Request) -> AnyPublisher, Error> { - let adaptedRequest = config.interceptor.adaptRequest(request) + let modifiedRequest = config.interceptor.adaptRequest(request) do { - let urlRequest = try adaptedRequest + let urlRequest = try modifiedRequest .toURLRequest(encoder: config.encoder, relativeTo: baseURL, accepting: config.decoder) return urlRequestPublisher(urlRequest) .validate(config.errorConverter) - .map { Response(data: $0.data, request: adaptedRequest) } - .handleEvents(receiveCompletion: { self.logIfFailure($0, for: adaptedRequest) }) + .map { Response(data: $0.data, request: modifiedRequest) } .tryCatch { try self.rescue(error: $0, request: request) } + .handleEvents(receiveCompletion: { self.logIfFailure($0, for: modifiedRequest) }) .eraseToAnyPublisher() } catch {