00001 #ifndef ERIS_EXCEPTIONS_H
00002 #define ERIS_EXCEPTIONS_H
00003
00004 #include <Atlas/Objects/Root.h>
00005
00006 #include <sigc++/signal.h>
00007
00008 #include <string>
00009
00010 #include <stdexcept>
00011
00012 namespace Eris
00013 {
00014
00019 class BaseException : public std::runtime_error
00020 {
00021 public:
00022 BaseException(const std::string &m) :
00023 std::runtime_error(m), _msg(m) {;}
00024 virtual ~BaseException() throw();
00025 const std::string _msg;
00026 };
00027
00028 class InvalidOperation : public BaseException
00029 {
00030 public:
00031 InvalidOperation(const std::string &m) : BaseException(m) {;}
00032 virtual ~InvalidOperation() throw();
00033 };
00034
00036
00037 class IllegalMessage : public BaseException
00038 {
00039 public:
00040 IllegalMessage(const Atlas::Message::Element &m, const std::string &s) :
00041 BaseException(s), what(m) {;}
00042 virtual ~IllegalMessage() throw();
00043
00044 Atlas::Message::Element what;
00045 };
00046
00048 class IllegalObject : public BaseException
00049 {
00050 public:
00051 IllegalObject(const Atlas::Objects::Root &o, const std::string &s) :
00052 BaseException(s), what(o) {;}
00053 virtual ~IllegalObject() throw();
00054
00055 Atlas::Objects::Root what;
00056 };
00057
00058 class NetworkFailure : public BaseException
00059 {
00060 public:
00061 NetworkFailure(const std::string &s) :
00062 BaseException(s) {;}
00063 virtual ~NetworkFailure() throw();
00064 };
00065
00066 class UnknownEntity : public BaseException
00067 {
00068 public:
00069 UnknownEntity(const std::string &msg, const std::string &id) :
00070 BaseException(msg), _id(id) {;}
00071 virtual ~UnknownEntity() throw();
00072 std::string _id;
00073 };
00074
00075 class UnknownProperty : public InvalidOperation
00076 {
00077 public:
00078 UnknownProperty(const std::string &p, const std::string &m) :
00079 InvalidOperation(m), prop(p)
00080 {;}
00081 virtual ~UnknownProperty() throw();
00082
00083 const std::string prop;
00084 };
00085
00087
00089 typedef SigC::Signal0<void> Signal;
00090
00100 class OperationBlocked
00101 {
00102 public:
00103 OperationBlocked(Signal &rsig) :
00104 _continue(rsig)
00105 {;}
00106
00107 Signal& _continue;
00108 };
00109
00111
00112 }
00113
00114 #endif