00001 #ifndef FWCore_Utilities_EDMException_h
00002 #define FWCore_Utilities_EDMException_h
00003
00011 #include "FWCore/Utilities/interface/Exception.h"
00012 #include <map>
00013 #include <string>
00014
00015 #define EDM_MAP_ENTRY(map, ns, name) map[ns::name]=#name
00016 #define EDM_MAP_ENTRY_NONS(map, name) map[name]=#name
00017
00018 namespace edm {
00019 namespace errors {
00020
00021
00022
00023
00024
00025
00026 enum ErrorCodes {
00027 CommandLineProcessing = 7000,
00028 ConfigFileNotFound = 7001,
00029 ConfigFileReadError = 7002,
00030
00031 OtherCMS = 8001,
00032 StdException = 8002,
00033 Unknown = 8003,
00034 BadAlloc = 8004,
00035 BadExceptionType = 8005,
00036
00037 ProductNotFound = 8006,
00038 DictionaryNotFound = 8007,
00039 InsertFailure = 8008,
00040 Configuration = 8009,
00041 LogicError = 8010,
00042 UnimplementedFeature = 8011,
00043 InvalidReference = 8012,
00044 NullPointerError = 8013,
00045 NoProductSpecified = 8014,
00046 EventTimeout = 8015,
00047 EventCorruption = 8016,
00048
00049 ScheduleExecutionFailure = 8017,
00050 EventProcessorFailure = 8018,
00051
00052 FileInPathError = 8019,
00053 FileOpenError = 8020,
00054 FileReadError = 8021,
00055 FatalRootError = 8022,
00056 MismatchedInputFiles = 8023,
00057
00058 ProductDoesNotSupportViews = 8024,
00059 ProductDoesNotSupportPtr = 8025,
00060
00061 NotFound = 8026,
00062 FormatIncompatibility = 8027,
00063 FallbackFileOpenError = 8028
00064 };
00065
00066 }
00067
00068 class Exception : public cms::Exception {
00069 public:
00070 typedef errors::ErrorCodes Code;
00071
00072 explicit Exception(Code category);
00073
00074 Exception(Code category, std::string const& message);
00075 Exception(Code category, char const* message);
00076
00077 Exception(Code category, std::string const& message, cms::Exception const& another);
00078 Exception(Code category, char const* message, cms::Exception const& another);
00079
00080 Exception(Exception const& other);
00081
00082 virtual ~Exception() throw();
00083
00084 void swap(Exception& other) {
00085 std::swap(category_, other.category_);
00086 }
00087
00088 Exception& operator=(Exception const& other);
00089
00090 Code categoryCode() const { return category_; }
00091
00092 static std::string codeToString(Code);
00093
00094 typedef std::map<Code, std::string> CodeMap;
00095
00096 static void throwThis(Code category,
00097 char const* message0 = "",
00098 char const* message1 = "",
00099 char const* message2 = "",
00100 char const* message3 = "",
00101 char const* message4 = "");
00102 static void throwThis(Code category, char const* message0, int intVal, char const* message2 = "");
00103
00104 virtual Exception* clone() const;
00105
00106 private:
00107
00108 virtual void rethrow();
00109 virtual int returnCode_() const;
00110
00111 Code category_;
00112 };
00113 }
00114
00115 #endif