Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: should I check for read errors after urdl::stream::rdbuf() #8

Open
jamiebullock opened this issue Aug 29, 2017 · 0 comments

Comments

@jamiebullock
Copy link

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());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant