[+] Handle HTTP errors
This commit is contained in:
@@ -86,6 +86,12 @@ func send<T: Decodable>(_ api: API<T>, _ params: [String: String]? = [:], _ succ
|
|||||||
success(obj)
|
success(obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Failed
|
||||||
|
else
|
||||||
|
{
|
||||||
|
let data = String(data: raw, encoding: .utf8) ?? "Error"
|
||||||
|
err("\(response.statusCode) - \(data)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute task
|
// Execute task
|
||||||
|
|||||||
Reference in New Issue
Block a user