Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

Exceptions.h

Go to the documentation of this file.
00001 #ifndef EXCEPTIONS_H 00002 #define EXCEPTIONS_H 00003 00004 #include <string> 00005 #include <exception> 00006 00007 #include <nmstl_util.h> 00008 #include <StorageMgr_Exceptions.h> 00009 #include "StackTrace.h" 00010 00011 BOREALIS_NAMESPACE_BEGIN; 00012 00013 #define Throw(type, message) throw type(message, __FILE__, __LINE__) 00014 00023 class AuroraException : public exception { 00024 public: 00032 AuroraException(string message, string file = string(), unsigned int line = 0, 00033 const char *type = "AuroraException"); 00034 00036 virtual ~AuroraException() throw(); 00037 00041 virtual const char *what() const throw() { return _message.c_str(); } 00042 00044 string getMessage() const { return _message; } 00045 00048 string getFile() const { return _file; } 00049 00052 unsigned int getLine() const { return _line; } 00053 00056 const char *getType() const { return _type; } 00057 00059 string as_string() const; 00060 00063 string getStackTrace() const; 00064 00065 private: 00066 string _message; 00067 string _file; 00068 unsigned int _line; 00069 const char *_type; 00070 ptr<StackTrace> _trace; 00071 }; 00072 00073 #define AURORA_EXCEPTION_TYPE(cl) \ 00074 class cl : public AuroraException { \ 00075 public: \ 00076 cl(string message, string file = string(), unsigned int line = 0) : \ 00077 AuroraException(message, file, line, #cl) {} \ 00078 }; 00079 00080 // Requested an entity which doesn't exist 00081 AURORA_EXCEPTION_TYPE(AuroraNoSuchEntityException); 00082 00083 // Non-well-formed XML 00084 AURORA_EXCEPTION_TYPE(AuroraBadXmlException); 00085 00086 // Semantically invalid XML (e.g., box doesn't have a type) 00087 AURORA_EXCEPTION_TYPE(AuroraBadEntityException); 00088 00089 // Typechecking failed 00090 AURORA_EXCEPTION_TYPE(AuroraTypingException); 00091 00092 // Miscellaneous illegal argument 00093 AURORA_EXCEPTION_TYPE(AuroraIllegalArgumentException); 00094 00095 // A stream has been closed, and thus means this method should either 00096 // unblock immediately, or is now illegal given the closed state. 00097 AURORA_EXCEPTION_TYPE(AuroraClosedException); 00098 00099 // No more data could be written to a file for some reason 00100 AURORA_EXCEPTION_TYPE(AuroraFileFullException); 00101 00102 // The filesystem is out of space when a write attempt occured 00103 AURORA_EXCEPTION_TYPE(AuroraFileSystemFullException); 00104 00105 BOREALIS_NAMESPACE_END; 00106 00107 #endif

Generated on Fri Nov 12 15:15:21 2004 for Borealis by doxygen 1.3.8