Skip to content
Snippets Groups Projects
Commit 57f773ff authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

[TracerRealTime] Check that output file is valid.

parent e34bd06d
No related branches found
No related tags found
No related merge requests found
......@@ -125,6 +125,11 @@ void TracerRealTime::openFile(const SignalBase<int> &sig,
string filename = rootdir + basename + signame + suffix;
dgDEBUG(5) << "Sig <" << sig.getName() << ">: new file " << filename << endl;
std::ofstream *newfile = new std::ofstream(filename.c_str());
if (!newfile->good()) {
delete newfile;
DG_THROW ExceptionTraces(ExceptionTraces::NOT_OPEN,
"Could not open file " + filename + " for signal " + signame, "");
}
dgDEBUG(5) << "Newfile:" << (void *)newfile << endl;
hardFiles.push_back(newfile);
dgDEBUG(5) << "Creating Outstringstream" << endl;
......@@ -264,7 +269,7 @@ void TracerRealTime::recordSignal(std::ostream &os,
<< "> " << endl;
} catch (ExceptionAbstract &exc) {
throw exc;
throw;
} catch (...) {
DG_THROW ExceptionTraces(ExceptionTraces::NOT_OPEN,
"The buffer is not open", "");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment