Skip to content

Commit c0ed67d

Browse files
committed
chore: regenerate sdk
1 parent 6e56457 commit c0ed67d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Sources/Appwrite/Client.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,20 +367,24 @@ open class Client {
367367
default:
368368
var message = ""
369369
var type = ""
370+
var responseString = ""
370371

371372
do {
372373
let dict = try JSONSerialization.jsonObject(with: data) as? [String: Any]
373374

374375
message = dict?["message"] as? String ?? response.status.reasonPhrase
375376
type = dict?["type"] as? String ?? ""
377+
responseString = String(decoding: data.readableBytesView, as: UTF8.self)
376378
} catch {
377379
message = data.readString(length: data.readableBytes)!
380+
responseString = message
378381
}
379382

380383
throw AppwriteError(
381384
message: message,
382385
code: Int(response.status.code),
383-
type: type
386+
type: type,
387+
response: responseString
384388
)
385389
}
386390
}

Sources/Appwrite/Models/AppwriteError.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ open class AppwriteError : Swift.Error, Decodable {
55
public let message: String
66
public let code: Int?
77
public let type: String?
8+
public let response: String
89

9-
init(message: String, code: Int? = nil, type: String? = nil) {
10+
init(message: String, code: Int? = nil, type: String? = nil, response: String = "") {
1011
self.message = message
1112
self.code = code
1213
self.type = type
14+
self.response = response
1315
}
1416
}
1517

0 commit comments

Comments
 (0)