00001
00002 #ifndef CjicException_h
00003 #define CjicException_h 1
00004
00005
00006 #include <stdexcept>
00007 #include <strstream>
00008 #include "jic/log/trazas.hpp"
00009
00010
00011
00012
00013 class CjicException : public std::runtime_error
00014 {
00015
00016 public:
00017 CjicException (const std::string& strDesc);
00018
00019
00020
00021 protected:
00022
00023
00024 private:
00025
00026
00027 private:
00028
00029
00030 };
00031
00032
00033
00034 inline CjicException::CjicException (const std::string& strDesc)
00035 : std::runtime_error(strDesc)
00036 {
00037 }
00038
00039 #ifdef DEBUG
00040
00041 #define THROW(Excepcion, Descripcion) \
00042 { \
00043 std::strstream * info = new std::strstream; \
00044 (*info) << #Excepcion << ": " << Descripcion << " ( " << __FILE__ << ", " << __LINE__ << " )" << std::ends; \
00045 char *cadena = info->str(); \
00046 Excepcion exc(cadena); \
00047 delete cadena; \
00048 delete info; \
00049 SUCESO(exc.what()); \
00050 throw(exc); \
00051 }
00052
00053 #else
00054
00055 #define THROW(Excepcion, Descripcion) \
00056 { \
00057 std::strstream * info = new std::strstream; \
00058 (*info) << #Excepcion << ": " << Descripcion << std::ends; \
00059 char *cadena = info->str(); \
00060 Excepcion exc(cadena); \
00061 delete cadena; \
00062 delete info; \
00063 SUCESO(exc.what()); \
00064 throw(exc); \
00065 }
00066
00067 #endif
00068
00069 #endif