libStatGen Software
1
ErrorHandler.h
1
/*
2
* Copyright (C) 2010 Regents of the University of Michigan
3
*
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef __ERROR_HANDLER_H__
19
#define __ERROR_HANDLER_H__
20
21
#include <iostream>
22
23
/// Class that controls the handling of errors.
24
class
ErrorHandler
25
{
26
public
:
27
28
/// This specifies how this class should respond to errors.
29
enum
HandlingType
{
EXCEPTION
,
///< throw an exception for the error
30
ABORT
,
///< exit the program on the error
31
RETURN
///< just return failure on the error
32
};
33
34
/// Constructor
35
ErrorHandler
();
36
37
/// Destructor
38
~ErrorHandler
();
39
40
/// Handle an error based on the error handling type.
41
static
void
handleError
(
const
char
* message,
42
HandlingType
handlingType =
EXCEPTION
);
43
44
private
:
45
};
46
47
48
#endif
ErrorHandler::handleError
static void handleError(const char *message, HandlingType handlingType=EXCEPTION)
Handle an error based on the error handling type.
Definition:
ErrorHandler.cpp:36
ErrorHandler::~ErrorHandler
~ErrorHandler()
Destructor.
Definition:
ErrorHandler.cpp:31
ErrorHandler::RETURN
@ RETURN
just return failure on the error
Definition:
ErrorHandler.h:31
ErrorHandler::HandlingType
HandlingType
This specifies how this class should respond to errors.
Definition:
ErrorHandler.h:29
ErrorHandler::EXCEPTION
@ EXCEPTION
throw an exception for the error
Definition:
ErrorHandler.h:29
ErrorHandler::ABORT
@ ABORT
exit the program on the error
Definition:
ErrorHandler.h:30
ErrorHandler::ErrorHandler
ErrorHandler()
Constructor.
Definition:
ErrorHandler.cpp:25
ErrorHandler
Class that controls the handling of errors.
Definition:
ErrorHandler.h:25
general
ErrorHandler.h
Generated by
1.8.18