← Back to team overview

nrtb-core team mailing list archive

[Question #148070]: How do we define C++ exceptions?

 

New question #148070 on New Real Time Battle:
https://answers.launchpad.net/nrtb/+question/148070

Basically, we have two easy options for defining exceptions in C++ classes and programs: We can use the POCO::Exception class or the older and less capable NTRB::base_exception.

Setup for either is pretty simple, but the Poco::Exception class has the advantage of being able to carry significant additional information about the exception with very little extra effort. Both of the following examples would occur in the public section of the transceiver class header...

The old style exception is declared like this:

    // parent of all transceiver exceptions.
    class general_exception:: public ntrb::base_exception {}

The Poco::Exception version is like this:

          // parent of all transceiver exceptions
	  POCO_DECLARE_EXCEPTION(transceiver, general_exception, Poco::Exception)

I don't see either as very complex or hard to use, but knowing the limitations of the older NRTB::base_exception (a rebranded ricklib::base_exception of which I'm the original author), I'd prefer to use the Poco::Exception class.

Whichever way we go, I'd like for us to be consistent within NRTB and I'd like us to settle this soon so that we don't have to go  back and re-engineer a lot of stuff to get it all in line later. Therefore, I'm gonna hold this question open until Friday, March 11th, 2011, at which time a final decision will be published.

-- 
You received this question notification because you are a member of NRTB
Core, which is an answer contact for New Real Time Battle.