Skip to content

Commit 1379d41

Browse files
committed
call failure
1 parent 28797dd commit 1379d41

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

StudyplusSDK/StudyplusAPIRequest.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ internal struct StudyplusAPIRequest {
5959

6060
private func start(path: String, method: String, body: [String: Any], success: @escaping (_ response: [AnyHashable: Any]?) -> Void, failure: @escaping (_ statusCode: Int, _ response: [String: Any]?) -> Void) {
6161

62-
guard let url = buildUrl(path: path) else { return }
62+
guard let url = buildUrl(path: path) else {
63+
failure(0, nil)
64+
return
65+
}
6366

6467
var request = URLRequest(url: url)
6568
request.httpMethod = method
@@ -69,6 +72,7 @@ internal struct StudyplusAPIRequest {
6972
request.addValue("application/json; charaset=utf-8", forHTTPHeaderField: "Content-Type")
7073
request.httpBody = data
7174
} catch {
75+
failure(0, nil)
7276
return
7377
}
7478

0 commit comments

Comments
 (0)