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
00081
AURORA_EXCEPTION_TYPE(AuroraNoSuchEntityException);
00082
00083
00084
AURORA_EXCEPTION_TYPE(AuroraBadXmlException);
00085
00086
00087
AURORA_EXCEPTION_TYPE(AuroraBadEntityException);
00088
00089
00090
AURORA_EXCEPTION_TYPE(AuroraTypingException);
00091
00092
00093
AURORA_EXCEPTION_TYPE(AuroraIllegalArgumentException);
00094
00095
00096
00097
AURORA_EXCEPTION_TYPE(AuroraClosedException);
00098
00099
00100
AURORA_EXCEPTION_TYPE(AuroraFileFullException);
00101
00102
00103
AURORA_EXCEPTION_TYPE(AuroraFileSystemFullException);
00104
00105 BOREALIS_NAMESPACE_END;
00106
00107
#endif