3
* Summary: The class which defines the base class for exceptions.
4
* Written by: nikal and xmp
6
* Copyright (C) 2002 nikal, xmp.
7
* This code is distributed under the GPL.
8
* See file COPYING for details.
10
* Change History (most recent first):
14
Copyright (C) 2002 Nikal, Xmp
15
Copyright (C) 2008 Erik Hjortsberg
17
This program is free software; you can redistribute it and/or modify
18
it under the terms of the GNU General Public License as published by
19
the Free Software Foundation; either version 2 of the License, or
20
(at your option) any later version.
22
This program is distributed in the hope that it will be useful,
23
but WITHOUT ANY WARRANTY; without even the implied warranty of
24
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
GNU General Public License for more details.
27
You should have received a copy of the GNU General Public License
28
along with this program; if not, write to the Free Software
29
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33
#ifndef EMBER_EXCEPTION_H
34
#define EMBER_EXCEPTION_H
43
* The default way to throw exceptions is to use one of the following macros.
46
// #define THROW(message) throw Exception(message, __FILE__, __LINE__);
47
// #define THROW1(message, p1) throw Exception(message, __FILE__, __LINE__, p1);
48
// #define THROW2(message, p1, p2) throw Exception(message, __FILE__, __LINE__, p1, p2);
49
// #define THROW3(message, p1, p2, p3) throw Exception(message, __FILE__, __LINE__, p1, p2, p3);
52
const int EXCEPTION_TEXT_SIZE = 1024;
55
* The base class for all exceptions that are thrown within Ember.
58
* @author Xmp (Martin Pollard)
59
* @author Erik Hjortsberg <erik.hjortsberg@gmail.com>
62
class Exception : public std::exception
68
* Creates a new generic Exception using default values.
73
* Creates a new generic Exception using the specified error description.
74
* @param error A descriptive string of the error.
76
Exception(const std::string& error);
79
* Creates a new generic Exception using the specified error string, file and line
81
* @param error A descriptive string of the error.
82
* @param file The file in which the error occured.
83
* @param line The line on which the error occurred.
85
Exception(const std::string& error, const std::string & file, int line, ...);
87
virtual ~Exception() throw();
90
* @brief Gets a descriptive string of the exception.
92
* @return A description of the error.
94
const std::string& getError() const;
97
* @brief Sets a descriptive string for this error.
98
* @param error The description of the error.
100
void setError(const std::string& error);
103
* @brief Gets a descriptive string of the exception.
105
* @return A description of the error.
107
virtual const char* what() const throw();
112
A description of the error.
114
std::string mErrorDescription;
117
The file in which the error occurred.
122
The line on which the error occurred.