Skip to content

Evaluate and remove generic try-blocks from the CTA catalogue code

For every member function in the CTA Catalogue code we have generic try-blocks for exception::Exception, like this:

try{
  [entire member function code]
} catch(exception::Exception &ex) {
  ex.getMessage().str(std::string(__FUNCTION__) + ": " + ex.getMessage().str());
  throw;
}

Their only purpose is to prepend the current function name to the exception message.

This was initially implemented as a poor-man's backtrace. However, since any exception::Exception exception already contains a backtrace that is printed when an uncaught exception occurs (code link), this poor-man's backtrace becomes redundant and unnecessary.

Therefore, as part of the CTA Catalogue code quality improvement, we should remove it.


Steps:

  • Check that the backtrace generation in exception::Exception is enough to produce reliable backtrace information (code link). In particular, we must be sure that all the debug symbols are available to our CTA deployments.
  • Check that the backtraces are captured and displayed correctly by our monitoring tools.
  • If both the steps above are guarantee, we can remove the unnecessary catch(exception::Exception &ex) try-blocks.
Edited by Joao Afonso