Main Page | Modules

Exception functions.


Functions

void fwUkl1Exception_raise (dyn_string &exceptionInfo, string exceptionType, string exceptionText, string exceptionCode)

Detailed Description

Contains the functions that are used to create an exception chain.

Function Documentation

void fwUkl1Exception_raise dyn_string &  exceptionInfo,
string  exceptionType,
string  exceptionText,
string  exceptionCode
 

A wrapper for fwException_raise(), fwUkl1Exception_raise() takes the same arguments, but will check that the exceptionText is of the form `Function(): Message', as defined by the framework, and will prepend `Unknown function(): ' to any exceptionText that does not contain `(): '.

Parameters:
exceptionInfo An array of strings that the exception information should be appended to.
exceptionType WARNING, ERROR and FATAL are permitted for this field. It is upto the user of the library to decide which is the most appropriate to use.
exceptionText A string to describe the exceptional condition that occured. Must be of the form `Function(): Message' where:
  • Function - the name of the function/button/thing that was executing when the when the exceptional condition arose.
  • Message - description of the exceptional condition that occured, a message to the function caller.
exceptionCode A number that indicates the exception that occured. This library reserves the error code value "0" for internal use.
Returns:
void.
Example
   (...)
   //Assume we are in the code body of a function with the prototype `void thisFunction(dyn_string& exceptionInfo)',
   //hence exceptionInfo has already been defined.
   //Check the size of exceptionInfo so we can see exception information is added by a function call.
   int exInfoSize = dynlen(exceptionInfo);
   //Call a function.
   someFunction(exceptionInfo);
   //Check size of the exceptionInfo to see if an error occured.
   if ( (exInfoSize == dynlen(exceptionInfo)) && (-1 != exInfoSize) ) {
     //... no error occured continue with normal function execution path.
   }//if(0==dynlen(exceptionInfo))
   else {
     //An error occured while calling someFunction. It is this might not cause thisFunction to fail so mark as a WARNING.
     //Details are provided and it is given a code of -1.
     fwUkl1Exception_raise(exceptionInfo, "WARNING", "thisFunction(): someFunction did not execute appropriate.", "-1");
   }//else(0==dynlen(exceptionInfo))

   (...)


Generated on Fri Jun 8 14:46:30 2007 by  doxygen 1.3.9.1