@@ -74,8 +74,8 @@ extension NetswiftError: CustomDebugStringConvertible {
74
74
description = " The response returned by the server does not conform to expected type "
75
75
case . noResponseError:
76
76
description = " The response returned by the server is empty / nil "
77
- case . responseDecodingError:
78
- description = " The response's raw data could not be understood "
77
+ case let . responseDecodingError( decodingError ) :
78
+ description = decodingError . fullDescription
79
79
case . responseCastingError:
80
80
description = " The response could not be casted to the Request's IncomingType "
81
81
case . notAuthenticated:
@@ -101,7 +101,7 @@ extension NetswiftError: CustomDebugStringConvertible {
101
101
}
102
102
103
103
return """
104
- Netswift Error: \( description)
104
+ \( description)
105
105
106
106
Payload:
107
107
\( payload? . prettyPrinted ?? " None " )
@@ -127,3 +127,20 @@ private extension Data {
127
127
}
128
128
}
129
129
}
130
+
131
+ private extension DecodingError {
132
+ var fullDescription : String {
133
+ switch self {
134
+ case . typeMismatch( let any, let context) :
135
+ return context. debugDescription
136
+ case . valueNotFound( let any, let context) :
137
+ return context. debugDescription
138
+ case . keyNotFound( let codingKey, let context) :
139
+ return context. debugDescription
140
+ case . dataCorrupted( let context) :
141
+ return context. debugDescription
142
+ @unknown default :
143
+ return " Unknown default decoding error "
144
+ }
145
+ }
146
+ }
0 commit comments