| 1 | #ifndef YEXCEPTION_H | 
| 2 | #define YEXCEPTION_H | 
| 3 |  | 
| 4 | #include <exception> | 
| 5 | #include <stdio.h> | 
| 6 |  | 
| 7 | using namespace std; | 
| 8 |  | 
| 9 | namespace yngn { | 
| 10 | namespace YException { | 
| 11 | class YException: public exception { | 
| 12 |  | 
| 13 | private: | 
| 14 |  | 
| 15 | protected: | 
| 16 | const char *message; | 
| 17 | char buff [100]; | 
| 18 | public: | 
| 19 | YException(const char *msg = "message"): message(msg){ } | 
| 20 | virtual ~YException () throw(){ } | 
| 21 | virtual const char* print () const throw () { return message; } | 
| 22 | }; | 
| 23 |  | 
| 24 | class NotFoundEnvironmentVarException: public YException { | 
| 25 | public: | 
| 26 | NotFoundEnvironmentVarException::NotFoundEnvironmentVarException(const char* msg):  YException(msg) {} | 
| 27 | NotFoundEnvironmentVarException::~NotFoundEnvironmentVarException () throw(){ } | 
| 28 | }; | 
| 29 |  | 
| 30 | class YSQLNotConnectedException: public YException { | 
| 31 | public: | 
| 32 | YSQLNotConnectedException::YSQLNotConnectedException(const char* msg):  YException(msg) {} | 
| 33 | YSQLNotConnectedException::~YSQLNotConnectedException () throw(){ } | 
| 34 | }; | 
| 35 |  | 
| 36 | class YSQLQueryException: public YException { | 
| 37 | public: | 
| 38 | YSQLQueryException::YSQLQueryException(const char* msg):  YException(msg) {} | 
| 39 | YSQLQueryException::~YSQLQueryException () throw(){ } | 
| 40 | }; | 
| 41 |  | 
| 42 | class YSQLDuplicateRowException: public YException { | 
| 43 | public: | 
| 44 | YSQLDuplicateRowException::YSQLDuplicateRowException(const char* msg):  YException(msg) {} | 
| 45 | YSQLDuplicateRowException::~YSQLDuplicateRowException () throw(){ } | 
| 46 | }; | 
| 47 |  | 
| 48 | class YNotExistingFileException: public YException { | 
| 49 | public: | 
| 50 | YNotExistingFileException::YNotExistingFileException(const char* msg):  YException(msg) {} | 
| 51 | YNotExistingFileException::~YNotExistingFileException () throw(){ } | 
| 52 | }; | 
| 53 |  | 
| 54 | class YExistingFileException: public YException { | 
| 55 | public: | 
| 56 | YExistingFileException::YExistingFileException(const char* msg):  YException(msg) {} | 
| 57 | YExistingFileException::~YExistingFileException () throw(){ } | 
| 58 | }; | 
| 59 |  | 
| 60 | class YEmptyObjectException: public YException { | 
| 61 | public: | 
| 62 | YEmptyObjectException::YEmptyObjectException(const char* msg):  YException(msg) {} | 
| 63 | YEmptyObjectException::~YEmptyObjectException () throw(){ } | 
| 64 | }; | 
| 65 | class YSystemCommandException: public YException { | 
| 66 | public: | 
| 67 | YSystemCommandException::YSystemCommandException(const char* msg):  YException(msg) {} | 
| 68 | YSystemCommandException::~YSystemCommandException () throw(){ } | 
| 69 | }; | 
| 70 | class YProcessErrorException: public YException { | 
| 71 | public: | 
| 72 | YProcessErrorException::YProcessErrorException(const char* msg):  YException(msg) {} | 
| 73 | YProcessErrorException::~YProcessErrorException () throw(){ } | 
| 74 | }; | 
| 75 | } | 
| 76 | } | 
| 77 | #endif /* YEXCEPTION_H */ |