diff options
author | Max Kellermann <mk@cm4all.com> | 2020-12-11 14:13:53 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-12-15 17:03:24 +0100 |
commit | 1f312b2e42714ee80bec75a59662c448a8db1ed4 (patch) | |
tree | 844029dd271de052ff4b04312379b37684051e76 /test | |
parent | 1e3089ffb770c9f8e62769c9384cf699ee395cf5 (diff) |
curl/Handler: disallow OnData() to throw
This eliminates some complexity from class CurlRequest.
Diffstat (limited to 'test')
-rw-r--r-- | test/RunCurl.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/RunCurl.cxx b/test/RunCurl.cxx index f81e8097e..6f5ce1a1f 100644 --- a/test/RunCurl.cxx +++ b/test/RunCurl.cxx @@ -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 { |