CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/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        FallbackFileOpenError = 8028,
00064       
00065        ExceededResourceVSize = 8030,
00066        ExceededResourceRSS = 8031,
00067        ExceededResourceTime = 8032
00068     };
00069 
00070   }
00071 
00072   class Exception : public cms::Exception {
00073   public:
00074     typedef errors::ErrorCodes Code;
00075 
00076     explicit Exception(Code category);
00077 
00078     Exception(Code category, std::string const& message);
00079     Exception(Code category, char const*        message);
00080 
00081     Exception(Code category, std::string const& message, cms::Exception const& another);
00082     Exception(Code category, char const*        message, cms::Exception const& another);
00083 
00084     Exception(Exception const& other);
00085 
00086     virtual ~Exception() throw();
00087 
00088     void swap(Exception& other) {
00089       std::swap(category_, other.category_);
00090     }
00091 
00092     Exception& operator=(Exception const& other);
00093 
00094     Code categoryCode() const { return category_; }
00095 
00096     static std::string codeToString(Code);
00097 
00098     typedef std::map<Code, std::string> CodeMap; 
00099 
00100     static void throwThis(Code category,
00101                           char const* message0 = "",
00102                           char const* message1 = "",
00103                           char const* message2 = "",
00104                           char const* message3 = "",
00105                           char const* message4 = "");
00106     static void throwThis(Code category, char const* message0, int intVal, char const* message2 = "");
00107 
00108     virtual Exception* clone() const;
00109 
00110   private:
00111 
00112     virtual void rethrow();
00113     virtual int returnCode_() const;
00114 
00115     Code category_;
00116   };
00117 }
00118 
00119 #endif