handle http errors a bit better

This commit is contained in:
ouwou
2020-09-05 20:59:17 -04:00
parent 5e0a5bb964
commit 8e749ac3bf
3 changed files with 20 additions and 1 deletions

View File

@@ -100,5 +100,9 @@ void HTTPClient::CleanupFutures() {
void HTTPClient::OnResponse(cpr::Response r, std::function<void(cpr::Response r)> cb) {
CleanupFutures();
cb(r);
try {
cb(r);
} catch (std::exception &e) {
fprintf(stderr, "error handling response (%s, code %d): %s\n", r.url.c_str(), r.status_code, e.what());
}
}