mt
 All Classes Files Functions Enumerations Groups Pages
exception.h
1 /***************************************************************************
2  * Copyright (C) 2006 by Adolfo Rodriguez *
3  * adolfo.rodriguez@upc.edu *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
22 
23 // HEADER GUARD
24 #ifndef MT_EXCEPTION_H
25 #define MT_EXCEPTION_H
26 
27 // C++ STANDARD HEADERS
28 #include <stdexcept>
29 
30 // PROJECT HEADERS
31 #include <mt/util/assert/assert_template.h>
32 
33 
35 
36 namespace mt
37 {
38 
39 
41 
43 class Exception : public std::runtime_error
44 {
45 public:
46  Exception() : std::runtime_error("mt library error") {}
47  Exception(const std::string& what_arg) : std::runtime_error(what_arg) {}
48 };
49 
50 
52 class ZeroDivide : public Exception
53 {
54 public:
55  ZeroDivide() : Exception("Division by near-zero value") {}
56 };
57 
58 } // mt
59 
60 #endif // MT_EXCEPTION_H