Skip to content

Commit 058987c

Browse files
Merge pull request #716 from appwrite/fix-apple-error-type
2 parents 9e23c22 + a49893e commit 058987c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

templates/swift/Sources/Client.swift.twig

+4-1
Original file line numberDiff line numberDiff line change
@@ -301,18 +301,21 @@ open class Client {
301301
default:
302302
var message = ""
303303
var data = try await response.body.collect(upTo: Int.max)
304+
var type = ""
304305

305306
do {
306307
let dict = try JSONSerialization.jsonObject(with: data) as? [String: Any]
307308

308309
message = dict?["message"] as? String ?? response.status.reasonPhrase
310+
type = dict?["type"] as? String ?? ""
309311
} catch {
310312
message = data.readString(length: data.readableBytes)!
311313
}
312314

313315
throw {{ spec.title | caseUcfirst }}Error(
314316
message: message,
315-
code: Int(response.status.code)
317+
code: Int(response.status.code),
318+
type: type
316319
)
317320
}
318321
}

0 commit comments

Comments
 (0)