DCA Error Handling


Collection of classes used for error handling and return codes.

There (at least) two different types of function prototypes.
One that returns a FunctionResult and one that returns an instance of a DCA object.
Functions that return a FunctionResult do not throw an exception.
                FunctionResult fr = function1();
The FunctionResult::operator bool() can be used to determine whether an error has occured.
Functions that return an instance to a DCA object throw an exception on error.
                AnyInstance = function2();
The details of the error can be examined by using the ExDca::getReturnCode() function
Use a dca::ExDca try-catch handler for all methods that do not return a FunctionResult.
Ensure that you have defined (at least) an dca::ExDca catch handler at the highest level of your application.
See also:
DCA Generic Error Codes

Error Handling Sample

void main()
        try {
                // required 3rd party library startups
                // may throw an ExDca
                dca::DcaInstance myDca = dca::DcaInstance::create( myInitData );

                // call a function that returns a FunctionResult...
                dca::FunctionResult myFR = aDcaClass.doSomething();
                if( !myFR ) {
                        // error occurred! -> log error and abort
                        cout << "DCA error return code received; Error code: " << myFR.getReturnCode()
                                 << ", Description: " << myFR.getDescription() << endl;

        catch( const dca::ExDca& ex ) {
                cout << "DCA error occurred; Error code: " << ex.getReturnCode()
                         << ", Description: " << ex.getDescription()
                         << ". Aborting" << endl;
        // required 3rd party library shutdowns


class  dca::FunctionResult
 Standard function result. More...
class  dca::ExDca
 Exception class used in the DCA. More...

Generated on 26 Sep 2016 for dca_interface by  doxygen 1.6.1