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
00031
00032 #ifndef __EXCEPTIONS_H__
00033 #define __EXCEPTIONS_H__
00034
00035 #include "zmmf/zmmf.h"
00036
00037 #define EXCEPTION_DATA __FILE__, __LINE__, __func__
00038 #define _UpnpException(code, msg) UpnpException(code, msg, EXCEPTION_DATA)
00039 #define _StorageException(usermsg, debugmsg) StorageException(usermsg, debugmsg, EXCEPTION_DATA)
00040 #define _ObjectNotFoundException(msg) ObjectNotFoundException(msg, EXCEPTION_DATA)
00041 #define _ServerShutdownException(msg) ServerShutdownException(msg, EXCEPTION_DATA)
00042 #define _TryAgainException(msg) TryAgainException(msg, EXCEPTION_DATA)
00043
00044 class UpnpException : public zmm::Exception
00045 {
00046 protected:
00047 int errCode;
00048 public:
00049 UpnpException(int errCode, zmm::String message);
00050 UpnpException(int errCode, zmm::String message, const char *file, int line, const char *function);
00051 inline int getErrorCode() { return errCode; }
00052 };
00053
00054 class StorageException : public zmm::Exception
00055 {
00056 protected:
00057 zmm::String userMessage;
00058 public:
00059 inline StorageException(zmm::String _userMessage, zmm::String message) : zmm::Exception(message) { userMessage = _userMessage; }
00060 inline StorageException(zmm::String _userMessage, zmm::String message, const char *file, int line, const char* function) :
00061 zmm::Exception(message, file, line, function) { userMessage = _userMessage; }
00062 zmm::String getUserMessage() { return (userMessage != nil ? userMessage : message); }
00063 };
00064
00065 class ObjectNotFoundException : public StorageException
00066 {
00067 public:
00068 inline ObjectNotFoundException(zmm::String message) : StorageException(message, message) {}
00069 inline ObjectNotFoundException(zmm::String message, const char *file, int line, const char* function) :
00070 StorageException(message, message, file, line, function) {}
00071 };
00072
00073 class SubtitlesNotFoundException : public zmm::Exception
00074 {
00075 public:
00076 inline SubtitlesNotFoundException(zmm::String message) : zmm::Exception(message) {}
00077 inline SubtitlesNotFoundException(zmm::String message, const char *file, int line, const char* function) : zmm::Exception(message, file, line, function) {}
00078 };
00079
00080 class ServerShutdownException : public zmm::Exception
00081 {
00082 public:
00083 inline ServerShutdownException(zmm::String message) : zmm::Exception(message) {}
00084 inline ServerShutdownException(zmm::String message, const char *file, int line, const char* function) : zmm::Exception(message, file, line, function) {}
00085 };
00086
00087 class TryAgainException : public zmm::Exception
00088 {
00089 public:
00090 inline TryAgainException(zmm::String message) : zmm::Exception(message) {}
00091 inline TryAgainException(zmm::String message, const char *file, int line, const char* function) : zmm::Exception(message, file, line, function) {}
00092 };
00093
00094 class SingletonException : public zmm::Exception
00095 {
00096 public:
00097 inline SingletonException(zmm::String message) : zmm::Exception(message) {}
00098 inline SingletonException(zmm::String message, const char *file, int line, const char* function) : zmm::Exception(message, file, line, function) {}
00099 };
00100
00101
00102 #endif // __EXCEPTIONS_H__