Skip to content

Commit

Permalink
logging: Don't throw from Activity destructor
Browse files Browse the repository at this point in the history
Move definition of destructor to logging.cc for
access to util.hh's ignoreException.
  • Loading branch information
dtzWill committed Mar 6, 2018
1 parent 70dbac7 commit e917c05
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/libutil/logging.cc
Expand Up @@ -221,4 +221,12 @@ bool handleJSONLogMessage(const std::string & msg,
return true;
}

Activity::~Activity() {
try {
logger.stopActivity(id);
} catch (...) {
ignoreException();
}
}

}
3 changes: 1 addition & 2 deletions src/libutil/logging.hh
Expand Up @@ -94,8 +94,7 @@ struct Activity

Activity(const Activity & act) = delete;

~Activity()
{ logger.stopActivity(id); }
~Activity();

void progress(uint64_t done = 0, uint64_t expected = 0, uint64_t running = 0, uint64_t failed = 0) const
{ result(resProgress, done, expected, running, failed); }
Expand Down

0 comments on commit e917c05

Please sign in to comment.