libStatGen Software 1
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

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.

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

Constructor & Destructor Documentation

◆ ErrorHandler()

ErrorHandler::ErrorHandler ( )

Constructor.

Definition at line 25 of file ErrorHandler.cpp.

26{
27}

◆ ~ErrorHandler()

ErrorHandler::~ErrorHandler ( )

Destructor.

Definition at line 31 of file ErrorHandler.cpp.

32{
33}

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.

38{
39 // Check the handling type.
40 switch(handlingType)
41 {
42 case(EXCEPTION):
43 throw(std::runtime_error(message));
44 break;
45 case(ABORT):
46 std::cerr << message << "\nExiting" << std::endl;
47 PhoneHome::completionStatus("ErrorHandler: Exiting due to Error");
48 exit(-1);
49 break;
50 case(RETURN):
51 return;
52 break;
53 default:
54 std::cerr << message << "\nUnknown Handle Type: Exiting"
55 << std::endl;
56 PhoneHome::completionStatus("Exiting, ErrorHandler::unknown handle type.");
57 exit(-1);
58 break;
59 }
60}

References ABORT, EXCEPTION, and RETURN.

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


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