CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/FWCore/Utilities/interface/EDMException.h

Go to the documentation of this file.
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     // If you add a new entry to the set of values, make sure to
00022     // update the translation map in EDMException.cc, the actions
00023     // table in FWCore/Framework/src/Actions.cc, and the configuration
00024     // fragment FWCore/Framework/python/test/cmsExceptionsFatalOption_cff.py.
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     };
00064 
00065   }
00066 
00067   class Exception : public cms::Exception {
00068   public:
00069     typedef errors::ErrorCodes Code;
00070 
00071     explicit Exception(Code category);
00072 
00073     Exception(Code category, std::string const& message);
00074     Exception(Code category, char const*        message);
00075 
00076     Exception(Code category, std::string const& message, cms::Exception const& another);
00077     Exception(Code category, char const*        message, cms::Exception const& another);
00078 
00079     Exception(Exception const& other);
00080 
00081     virtual ~Exception() throw();
00082 
00083     Code categoryCode() const { return category_; }
00084 
00085     static std::string codeToString(Code);
00086 
00087     typedef std::map<Code, std::string> CodeMap; 
00088 
00089     static void throwThis(Code category,
00090                           char const* message0 = "",
00091                           char const* message1 = "",
00092                           char const* message2 = "",
00093                           char const* message3 = "",
00094                           char const* message4 = "");
00095     static void throwThis(Code category, char const* message0, int intVal, char const* message2 = "");
00096 
00097     virtual Exception* clone() const;
00098 
00099   private:
00100 
00101     virtual void rethrow();
00102     virtual int returnCode_() const;
00103 
00104     Code category_;
00105   };
00106 }
00107 
00108 #endif