Slice Tools libFoundation |
Exceptions.hhGo to the documentation of this file.00001 // $Id: Exceptions.hh,v 1.1 2005/07/29 02:55:15 mschatz Exp $ 00002 00005 00006 #ifndef EXCEPTIONS_HH 00007 #define EXCEPTIONS_HH 1 00008 00009 #include <string> 00010 #include <iostream> 00011 00013 class Exception 00014 { 00015 public: 00016 Exception(std::string msg, std::string module); 00017 00018 std::string getErrorMsg() const; 00019 std::string getModule() const; 00020 static std::string quote(std::string msg); 00021 00022 void setRawErrorMsg(std::string msg); 00023 void setModule(std::string module); 00024 00025 private: 00026 std::string m_errorMsg; 00027 std::string m_module; 00028 }; 00029 00030 std::ostream & operator<< (std::ostream & os, const Exception & exception); 00031 00033 00035 class FileIOError : public Exception 00036 { 00037 public: 00038 FileIOError(std::string msg, std::string module); 00039 }; 00040 00042 class UnableToReadError : public FileIOError 00043 { 00044 public: 00045 UnableToReadError(std::string msg, std::string module); 00046 }; 00047 00049 class UnableToOpenError : public FileIOError 00050 { 00051 public: 00052 UnableToOpenError(std::string msg, std::string module); 00053 }; 00054 00056 00058 class OptionsError : public Exception 00059 { 00060 public: 00061 OptionsError(std::string msg, std::string module="Options"); 00062 }; 00063 00065 class ExitProgramNormally : public OptionsError 00066 { 00067 public: 00068 ExitProgramNormally(std::string msg = "", std::string module = ""); 00069 }; 00070 00072 class InvalidOptionError : public OptionsError 00073 { 00074 public: 00075 InvalidOptionError(std::string msg, std::string module="Options"); 00076 }; 00077 00079 class MissingRequiredParameterError : public OptionsError 00080 { 00081 public: 00082 MissingRequiredParameterError(std::string msg, std::string module="Options"); 00083 }; 00084 00086 00088 class ConfigFileError : public Exception 00089 { 00090 public: 00091 ConfigFileError(std::string msg, std::string module="ConfigFile"); 00092 00093 }; 00094 00096 class DuplicateSectionError : public ConfigFileError 00097 { 00098 public: 00099 DuplicateSectionError(std::string msg, std::string module="ConfigFile"); 00100 }; 00101 00103 class ConfigFileLineTooLong : public ConfigFileError 00104 { 00105 public: 00106 ConfigFileLineTooLong(std::string msg, std::string module="ConfigFile"); 00107 }; 00108 00110 class CircularReferenceError : public ConfigFileError 00111 { 00112 public: 00113 CircularReferenceError(std::string msg, std::string module="ConfigSection"); 00114 }; 00115 00116 00118 class MalformedSubstitutionError : public ConfigFileError 00119 { 00120 public: 00121 MalformedSubstitutionError(std::string msg, std::string module="ConfigSection"); 00122 }; 00123 00124 00126 class UnresolvedSubstitutionError : public ConfigFileError 00127 { 00128 public: 00129 UnresolvedSubstitutionError(std::string msg, std::string module="ConfigSection"); 00130 }; 00131 00133 class InvalidConfigNameError : public ConfigFileError 00134 { 00135 public: 00136 InvalidConfigNameError(std::string msg, std::string module="ConfigSection"); 00137 }; 00138 00140 class InvalidConfiguration : public ConfigFileError 00141 { 00142 public: 00143 InvalidConfiguration(std::string msg, std::string module="ConfigSection"); 00144 }; 00145 00146 #endif |