Better exceptions
This commit is contained in:
parent
cc99cb0ea5
commit
6836a1bd40
@ -120,6 +120,9 @@ inline Data &Data::FillWithZeroes() {
|
||||
|
||||
inline void Data::StoreToFile(const boost::filesystem::path &filepath) const {
|
||||
std::ofstream file(filepath.c_str(), std::ios::binary | std::ios::trunc);
|
||||
if (!file.good()) {
|
||||
throw std::runtime_error("Could not open file for writing");
|
||||
}
|
||||
StoreToStream(file);
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,9 @@ TempFile::TempFile(const bf::path &path, bool create)
|
||||
: _path(path) {
|
||||
if (create) {
|
||||
ofstream file(_path.c_str());
|
||||
if (!file.good()) {
|
||||
throw std::runtime_error("Could not create tempfile");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user