00001 /* -*- Mode: C++; c-file-style: "stroustrup"; indent-tabs-mode: nil -*- */ 00002 /* 00003 * Exception.h 00004 * Header for the exception handler class. 00005 * 00006 * $Id: Exception.h,v 1.8 2002/04/08 07:11:28 benoit Exp $ 00007 * 00008 * Copyright (c) 2000-2001 Remi Lefebvre <remi@debian.org> 00009 * Copyright (c) 2000 Benoit Joly <benoit@dhis.net> 00010 * 00011 * DDT comes with ABSOLUTELY NO WARRANTY and is licenced under the 00012 * GNU General Public License (version 2 or later). This license 00013 * can be retrieved from http://www.gnu.org/copyleft/gnu.html. 00014 * 00015 */ 00016 00017 #include <string> 00018 00019 #ifndef EXCEPTION_H 00020 #define EXCEPTION_H 00021 00026 class DdtException 00027 { 00028 public: 00030 DdtException() { debugMessage = "generic error"; } 00031 00033 DdtException(const char *errmsg) { debugMessage = errmsg; } 00034 00036 virtual ~DdtException() { } 00037 00039 virtual std::string message() const { return debugMessage; } 00040 00041 protected: 00043 std::string debugMessage; 00044 00045 }; 00046 00047 00051 class DbError : public DdtException 00052 { 00053 public: 00055 DbError() { } 00056 00058 DbError(const char *errmsg) { debugMessage = errmsg; } 00059 }; 00060 00061 00062 #endif
1.4.4