00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #define ACEDIA_REDUCED_ANNOUNCE
00031
00032 #include "acedia_config.hpp"
00033 #include "acedia_string.hpp"
00034
00035
00036 #ifdef ACEDIA_WINDOWS
00037 #pragma warning ( disable: 4996 )
00038 #endif
00039
00040 #include "exceptions.hpp"
00041
00042 #include <cstring>
00043
00044 namespace acedia
00045 {
00046
00047 const char *Exception::what() const throw()
00048 {
00049 return msg;
00050 }
00051
00052 NullPointerException::NullPointerException(const char *msg) throw() :
00053 Exception(msg) { }
00054
00055 ClassCastException::ClassCastException(const char *mmsg,
00056 MetaClass *from,
00057 MetaClass *to) throw() :
00058 Exception(mmsg), m_from(from), m_to(to), m_onDemandWhat(NULL)
00059 {
00060 }
00061
00062 ClassCastException::~ClassCastException() throw()
00063 {
00064 if (m_onDemandWhat) delete m_onDemandWhat;
00065 }
00066
00067 const char *ClassCastException::what() const throw()
00068 {
00069 if (m_onDemandWhat) return m_onDemandWhat;
00070 try
00071 {
00072 std::string errorMessage;
00073 errorMessage
00074 .append("Could not cast ")
00075 .append(m_from->name().const_str())
00076 .append(" to ")
00077 .append(m_to->name().const_str())
00078 .append(this->msg);
00079 m_onDemandWhat = new char[errorMessage.size() + 1];
00080 ::strcpy(m_onDemandWhat, errorMessage.c_str());
00081 return m_onDemandWhat;
00082 }
00083 catch (...)
00084 {
00085 return this->msg;
00086 }
00087 }
00088
00089 NotDeserializableException::NotDeserializableException(const char *msg)
00090 throw() : Exception(msg) { }
00091
00092 IndexOutOfBoundsException::IndexOutOfBoundsException(const char *msg)
00093 throw() : Exception(msg) { }
00094
00095 ActorKilledException::ActorKilledException(boost::int32_t r) throw() :
00096 Exception("ActorKilled"), m_reason(r) { }
00097
00098 IOException::IOException(const char *msg) throw() :
00099 Exception(msg) { }
00100
00101 WSAStartupFailedException::WSAStartupFailedException(const char *msg)
00102 throw() : Exception(msg) { }
00103
00104 }