Skip to content

Application::run() documentation/implementation discrepancy #141

@aleks-f

Description

@aleks-f

http://pocoproject.org/forum/viewtopic.php?f=12&t=5813

by Edsoon » Tue Mar 26, 2013 12:36 pm

/// Runs the application by performing additional initializations
/// and calling the main() method.
///
/// First calls initialize(), then calls main(), and
/// finally calls uninitialize(). The latter will be called
/// even if main() throws an exception. If initialize() throws
/// an exception, main() will not be called and the exception
/// will be propagated to the caller.

int Application::run()
{
  int rc = EXIT_CONFIG;
  try
  {
    initialize(*this);
    rc = EXIT_SOFTWARE;
    rc = main(_unprocessedArgs);
    uninitialize();
  }
  catch (Poco::Exception& exc)
  {
    logger().log(exc);
  }
  catch (std::exception& exc)
  {
    logger().error(exc.what());
  }
  catch (...)
  {
    logger().fatal("system exception");
  }
  return rc;
}

But method uninitialize() not called if method main throws exception. If this happens our program can not complete normally.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions