We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9e23c22 + a49893e commit 058987cCopy full SHA for 058987c
templates/swift/Sources/Client.swift.twig
@@ -301,18 +301,21 @@ open class Client {
301
default:
302
var message = ""
303
var data = try await response.body.collect(upTo: Int.max)
304
+ var type = ""
305
306
do {
307
let dict = try JSONSerialization.jsonObject(with: data) as? [String: Any]
308
309
message = dict?["message"] as? String ?? response.status.reasonPhrase
310
+ type = dict?["type"] as? String ?? ""
311
} catch {
312
message = data.readString(length: data.readableBytes)!
313
}
314
315
throw {{ spec.title | caseUcfirst }}Error(
316
message: message,
- code: Int(response.status.code)
317
+ code: Int(response.status.code),
318
+ type: type
319
)
320
321
0 commit comments