Skip to content

Commit 3666092

Browse files
committed
If Driver catches errors and the error output is being redirected to a file it will now also record the error there rather than just spitting it out on cout
1 parent c1bffd6 commit 3666092

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

app/driver.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "chimbuko/verbose.hpp"
33
#include "chimbuko/util/string.hpp"
44
#include "chimbuko/util/commandLineParser.hpp"
5+
#include "chimbuko/util/error.hpp"
56
#include <chrono>
67
#include <cstdlib>
78

@@ -279,14 +280,17 @@ int main(int argc, char ** argv){
279280
}
280281
catch (const std::invalid_argument &e){
281282
std::cout << '[' << getDateTime() << ", rank " << params.rank << "] Driver : caught invalid argument: " << e.what() << std::endl;
283+
if(params.err_outputpath.size()) recoverable_error(std::string("Driver : caught invalid argument: ") + e.what()); //ensure errors also written to error logs
282284
error = true;
283285
}
284286
catch (const std::ios_base::failure &e){
285287
std::cout << '[' << getDateTime() << ", rank " << params.rank << "] Driver : I/O base exception caught: " << e.what() << std::endl;
288+
if(params.err_outputpath.size()) recoverable_error(std::string("Driver : I/O base exception caught: ") + e.what());
286289
error = true;
287290
}
288291
catch (const std::exception &e){
289292
std::cout << '[' << getDateTime() << ", rank " << params.rank << "] Driver : Exception caught: " << e.what() << std::endl;
293+
if(params.err_outputpath.size()) recoverable_error(std::string("Driver : Exception caught: ") + e.what());
290294
error = true;
291295
}
292296

0 commit comments

Comments
 (0)