Skip to content

Commit d2e775d

Browse files
authored
Merge pull request #227 from ecmwf/feature/eckit-638
ECKIT-638: Restore quiet exception capability for ecfs
2 parents 6f495bb + 2286108 commit d2e775d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/eckit/exception/Exceptions.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,17 @@ void Exception::exceptionStack(std::ostream& out, bool callStack) {
6363
out << "End stack" << std::endl;
6464
}
6565

66-
Exception::Exception(const std::string& w, const CodeLocation& loc) : what_(w), next_(first()), location_(loc) {
66+
Exception::Exception(const std::string& w, const CodeLocation& loc) : Exception(w, loc, false) {}
67+
68+
Exception::Exception(const std::string& w, const CodeLocation& loc, bool quiet) :
69+
what_(w), next_(first()), location_(loc) {
6770
callStack_ = BackTrace::dump();
6871

6972
if (getenv_on("ECKIT_EXCEPTION_DUMPS_BACKTRACE")) {
7073
std::cerr << "Exception dumping backtrace: " << callStack_ << std::endl;
7174
}
7275

73-
if (!getenv_on("ECKIT_EXCEPTION_IS_SILENT")) {
76+
if (!getenv_on("ECKIT_EXCEPTION_IS_SILENT") && !quiet) {
7477
Log::error() << "Exception: " << w << " " << location_ << std::endl;
7578
Log::status() << "** " << w << location_ << std::endl;
7679
}

src/eckit/exception/Exceptions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class Exception : public std::exception {
5959

6060
/// Constructors
6161
explicit Exception(const std::string& what, const CodeLocation& = {});
62+
explicit Exception(const std::string& what, const CodeLocation& loc, bool quiet);
6263
Exception();
6364

6465
Exception(const Exception&) = default;

0 commit comments

Comments
 (0)