Log error instead of asserting if writing file fails.

Also remove some unused code.
This commit is contained in:
Jacob Dufault 2018-01-04 09:33:35 -08:00
parent 08e856b85a
commit 327958dbe0
2 changed files with 5 additions and 8 deletions

View File

@ -456,15 +456,14 @@ void UpdateTestExpectation(const std::string& filename,
of.close(); of.close();
} }
void Fail(const std::string& message) {
LOG_S(FATAL) << "Fatal error: " << message;
std::exit(1);
}
void WriteToFile(const std::string& filename, const std::string& content) { void WriteToFile(const std::string& filename, const std::string& content) {
std::ofstream file(filename, std::ofstream file(filename,
std::ios::out | std::ios::trunc | std::ios::binary); std::ios::out | std::ios::trunc | std::ios::binary);
assert(file.good()); if (!file.good()) {
LOG_S(ERROR) << "Cannot write to " << filename;
return;
}
file << content; file << content;
} }

View File

@ -99,8 +99,6 @@ void UpdateTestExpectation(const std::string& filename,
const std::string& expectation, const std::string& expectation,
const std::string& actual); const std::string& actual);
void Fail(const std::string& message);
void WriteToFile(const std::string& filename, const std::string& content); void WriteToFile(const std::string& filename, const std::string& content);
// note: this implementation does not disable this overload for array types // note: this implementation does not disable this overload for array types