diff --git a/Source/Network/Implement/Client/JSONClient.swift b/Source/Network/Implement/Client/JSONClient.swift index 91cb573..51a7625 100644 --- a/Source/Network/Implement/Client/JSONClient.swift +++ b/Source/Network/Implement/Client/JSONClient.swift @@ -52,7 +52,7 @@ extension JSONClient { ) .then { code2XX, data -> ClientResult in guard let data, let body = try? JSON.parse(data) else { - throw JSONClientError.responseDataIsNotDecodable + throw JSONClientError.responseDataIsNotDecodable(code: code2XX, data: data) } @@ -67,7 +67,7 @@ extension JSONClient { } else if case DataClientError.statusCodeNot2XX(let codeNot2XX, let data) = error { guard let data, let body = try? JSON.parse(data) else { - throw JSONClientError.responseDataIsNotDecodable + throw JSONClientError.responseDataIsNotDecodable(code: codeNot2XX, data: data) } throw JSONClientError.statusCodeNot2XX(codeNot2XX: codeNot2XX, body: body) } @@ -80,5 +80,5 @@ public enum JSONClientError: Error { case statusCodeNotFound case statusCodeNot2XX(codeNot2XX: Int, body: JSON) case bodyIsNotEncodable - case responseDataIsNotDecodable + case responseDataIsNotDecodable(code: Int, data: Data?) }