curl/Handler: disallow OnData() to throw

This eliminates some complexity from class CurlRequest.
This commit is contained in:
Max Kellermann
2020-12-11 14:13:53 +01:00
committed by Max Kellermann
parent 1e3089ffb7
commit 1f312b2e42
4 changed files with 8 additions and 37 deletions

View File

@@ -50,8 +50,12 @@ public:
}
void OnData(ConstBuffer<void> data) override {
if (fwrite(data.data, data.size, 1, stdout) != 1)
throw std::runtime_error("Failed to write");
try {
if (fwrite(data.data, data.size, 1, stdout) != 1)
throw std::runtime_error("Failed to write");
} catch (...) {
OnError(std::current_exception());
}
}
void OnEnd() override {