|
IBR-DTNSuite 0.6
|
00001 #ifndef EXCEPTIONS_H_ 00002 #define EXCEPTIONS_H_ 00003 00004 #include "ibrcommon/Exceptions.h" 00005 00006 #include <stdexcept> 00007 #include <string> 00008 00009 00010 using namespace std; 00011 00012 namespace dtn 00013 { 00017 class InvalidDataException : public ibrcommon::Exception 00018 { 00019 public: 00020 InvalidDataException(string what = "Invalid input data.") throw() : Exception(what) 00021 { 00022 }; 00023 }; 00024 00025 class InvalidProtocolException : public dtn::InvalidDataException 00026 { 00027 public: 00028 InvalidProtocolException(string what = "The received data does not match the protocol.") throw() : dtn::InvalidDataException(what) 00029 { 00030 }; 00031 }; 00032 00033 class SerializationFailedException : public dtn::InvalidDataException 00034 { 00035 public: 00036 SerializationFailedException(string what = "The serialization failed.") throw() : dtn::InvalidDataException(what) 00037 { 00038 }; 00039 }; 00040 00041 class MissingObjectException : public ibrcommon::Exception 00042 { 00043 public: 00044 MissingObjectException(string what = "Object not available.") throw() : Exception(what) 00045 { 00046 }; 00047 }; 00048 00049 class ConnectionInterruptedException : public ibrcommon::IOException 00050 { 00051 public: 00052 ConnectionInterruptedException() : ibrcommon::IOException("The connection has been interrupted.") 00053 { 00054 } 00055 }; 00056 } 00057 00058 #endif /*EXCEPTIONS_H_*/