Loading...
Searching...
No Matches
ErrorHandler Class Reference

Class that controls the handling of errors. More...

`#include <ErrorHandler.h>`

## Public Types

enum | HandlingType { EXCEPTION , ABORT , RETURN }
| This specifies how this class should respond to errors. More...

## Public Member Functions

| ErrorHandler ()
| Constructor.
| ~ErrorHandler ()
| Destructor.

## Static Public Member Functions

static void | handleError (const char *message, HandlingType handlingType=EXCEPTION)
| Handle an error based on the error handling type.

## Detailed Description

Class that controls the handling of errors.

Definition at line 24 of file ErrorHandler.h.

## Member Enumeration Documentation

## HandlingType

enum ErrorHandler::HandlingType

This specifies how this class should respond to errors.

Enumerator
EXCEPTION | throw an exception for the error
ABORT | exit the program on the error
RETURN | just return failure on the error

Definition at line 29 of file ErrorHandler.h.

{EXCEPTION, ///< throw an exception for the error
ABORT, ///< exit the program on the error
RETURN ///< just return failure on the error
};
ErrorHandler::RETURN
@ RETURN
just return failure on the error
Definition ErrorHandler.h:31
ErrorHandler::ABORT
@ ABORT
exit the program on the error
Definition ErrorHandler.h:30
ErrorHandler::EXCEPTION
@ EXCEPTION
throw an exception for the error
Definition ErrorHandler.h:29

## Constructor & Destructor Documentation

## ErrorHandler()

ErrorHandler::ErrorHandler | ( |  | ) |

Constructor.

Definition at line 25 of file ErrorHandler.cpp.

{
}

## ~ErrorHandler()

ErrorHandler::~ErrorHandler | ( |  | ) |

Destructor.

Definition at line 31 of file ErrorHandler.cpp.

{
}

## Member Function Documentation

## handleError()

void ErrorHandler::handleError | ( | const char * | message,
|  | HandlingType | handlingType = EXCEPTION )

static

Handle an error based on the error handling type.

Definition at line 36 of file ErrorHandler.cpp.

{
// Check the handling type.
switch(handlingType)
{
case(EXCEPTION):
throw(std::runtime_error(message));
break;
case(ABORT):
std::cerr << message << "\nExiting" << std::endl;
PhoneHome::completionStatus("ErrorHandler: Exiting due to Error");
exit(-1);
break;
case(RETURN):
return;
break;
default:
std::cerr << message << "\nUnknown Handle Type: Exiting"
<< std::endl;
PhoneHome::completionStatus("Exiting, ErrorHandler::unknown handle type.");
exit(-1);
break;
}
}

References ABORT, EXCEPTION, and RETURN.

Referenced by CigarHelper::softClipBeginByRefPos(), and CigarHelper::softClipEndByRefPos().

The documentation for this class was generated from the following files:

- general/ErrorHandler.h
- general/ErrorHandler.cpp