Question: should I check for read errors after urdl::stream::rdbuf()
jamiebullock opened this issue · comments
Jamie Bullock commented
It's not clear to me how to correctly handle errors when using the following idiom:
std::ofstream os(path, std::ios_base::out | std::ios_base::binary);
if (!os)
{
throw std::runtime_error(...);
}
os << is.rdbuf();
is.close();
os.close();
Should I for example check after os << is.rdbuf()
using something like:
if (!is)
{
throw std::runtime_error(is.error().message());
}