00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __JackException__
00021 #define __JackException__
00022
00023 #include "JackCompilerDeps.h"
00024
00025 #include <stdexcept>
00026 #include <iostream>
00027 #include <string>
00028
00029 namespace Jack
00030 {
00031
00032 #define ThrowIf(inCondition, inException) \
00033 if(inCondition) \
00034 { \
00035 throw(inException); \
00036 }
00037
00038
00043 class SERVER_EXPORT JackException : public std::runtime_error {
00044
00045 public:
00046
00047 JackException(const std::string& msg) : std::runtime_error(msg)
00048 {}
00049 JackException(char* msg) : std::runtime_error(msg)
00050 {}
00051 JackException(const char* msg) : std::runtime_error(msg)
00052 {}
00053
00054 std::string Message()
00055 {
00056 return what();
00057 }
00058
00059 void PrintMessage();
00060
00061 };
00062
00067 class SERVER_EXPORT JackTemporaryException : public JackException {
00068
00069 public:
00070
00071 JackTemporaryException(const std::string& msg) : JackException(msg)
00072 {}
00073 JackTemporaryException(char* msg) : JackException(msg)
00074 {}
00075 JackTemporaryException(const char* msg) : JackException(msg)
00076 {}
00077 JackTemporaryException() : JackException("")
00078 {}
00079 };
00080
00085 class SERVER_EXPORT JackQuitException : public JackException {
00086
00087 public:
00088
00089 JackQuitException(const std::string& msg) : JackException(msg)
00090 {}
00091 JackQuitException(char* msg) : JackException(msg)
00092 {}
00093 JackQuitException(const char* msg) : JackException(msg)
00094 {}
00095 JackQuitException() : JackException("")
00096 {}
00097 };
00098
00103 class SERVER_EXPORT JackNetException : public JackException {
00104
00105 public:
00106
00107 JackNetException(const std::string& msg) : JackException(msg)
00108 {}
00109 JackNetException(char* msg) : JackException(msg)
00110 {}
00111 JackNetException(const char* msg) : JackException(msg)
00112 {}
00113 JackNetException() : JackException("")
00114 {}
00115 };
00116
00117 }
00118
00119 #endif