CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/FWCore/Utilities/src/EDMException.cc

Go to the documentation of this file.
00001 
00002 #include "FWCore/Utilities/interface/EDMException.h"
00003 
00004 namespace edm {
00005   namespace errors {
00006     struct FilledMap {
00007       FilledMap();
00008       edm::Exception::CodeMap trans_;
00009     };
00010     FilledMap::FilledMap() : trans_() {
00011       EDM_MAP_ENTRY_NONS(trans_, OtherCMS);
00012       EDM_MAP_ENTRY_NONS(trans_, StdException);
00013       EDM_MAP_ENTRY_NONS(trans_, Unknown);
00014       EDM_MAP_ENTRY_NONS(trans_, BadAlloc);
00015       EDM_MAP_ENTRY_NONS(trans_, BadExceptionType);
00016       EDM_MAP_ENTRY_NONS(trans_, ProductNotFound);
00017       EDM_MAP_ENTRY_NONS(trans_, DictionaryNotFound);
00018       EDM_MAP_ENTRY_NONS(trans_, NoProductSpecified);
00019       EDM_MAP_ENTRY_NONS(trans_, InsertFailure);
00020       EDM_MAP_ENTRY_NONS(trans_, Configuration);
00021       EDM_MAP_ENTRY_NONS(trans_, LogicError);
00022       EDM_MAP_ENTRY_NONS(trans_, UnimplementedFeature);
00023       EDM_MAP_ENTRY_NONS(trans_, InvalidReference);
00024       EDM_MAP_ENTRY_NONS(trans_, NullPointerError);
00025       EDM_MAP_ENTRY_NONS(trans_, EventTimeout);
00026       EDM_MAP_ENTRY_NONS(trans_, EventCorruption);
00027       EDM_MAP_ENTRY_NONS(trans_, ScheduleExecutionFailure);
00028       EDM_MAP_ENTRY_NONS(trans_, EventProcessorFailure);
00029       EDM_MAP_ENTRY_NONS(trans_, FileInPathError);
00030       EDM_MAP_ENTRY_NONS(trans_, FileOpenError);
00031       EDM_MAP_ENTRY_NONS(trans_, FileReadError);
00032       EDM_MAP_ENTRY_NONS(trans_, FatalRootError);
00033       EDM_MAP_ENTRY_NONS(trans_, MismatchedInputFiles);
00034       EDM_MAP_ENTRY_NONS(trans_, ProductDoesNotSupportViews);
00035       EDM_MAP_ENTRY_NONS(trans_, ProductDoesNotSupportPtr);
00036       EDM_MAP_ENTRY_NONS(trans_, NotFound);
00037     }
00038   }
00039 
00040   void getCodeTable(edm::Exception::CodeMap*& setme) {
00041     static errors::FilledMap fm;
00042     setme = &fm.trans_;
00043   }
00044 
00045 
00047 
00048   std::string Exception::codeToString(errors::ErrorCodes c) {
00049     extern void getCodeTable(CodeMap*&);
00050     CodeMap* trans;
00051     getCodeTable(trans);
00052     CodeMap::const_iterator i(trans->find(c));
00053     return i!=trans->end() ? i->second : std::string("UnknownCode");
00054   }
00055 
00056 
00057   Exception::Exception(errors::ErrorCodes aCategory):
00058     cms::Exception(codeToString(aCategory)),
00059     category_(aCategory) {
00060   }
00061 
00062   Exception::Exception(errors::ErrorCodes aCategory, std::string const& message):
00063     cms::Exception(codeToString(aCategory),message),
00064     category_(aCategory) {
00065   }
00066 
00067   Exception::Exception(errors::ErrorCodes aCategory, std::string const& message, cms::Exception const& another):
00068     cms::Exception(codeToString(aCategory),message,another),
00069     category_(aCategory) {
00070   }
00071 
00072   Exception::Exception(Exception const& other):
00073     cms::Exception(other),
00074     category_(other.category_) {
00075   }
00076 
00077   Exception::~Exception() throw() {
00078   }
00079 
00080   void
00081   Exception::throwThis(errors::ErrorCodes aCategory,
00082                        char const* message0,
00083                        char const* message1,
00084                        char const* message2,
00085                        char const* message3,
00086                        char const* message4) {
00087     Exception e(aCategory, std::string(message0));
00088     e << message1 << message2 << message3 << message4;
00089     throw e;
00090   }
00091 
00092   void
00093   Exception::throwThis(errors::ErrorCodes aCategory, char const* message0, int intVal, char const* message1) {
00094     Exception e(aCategory, std::string(message0));
00095     e << intVal << message1;
00096     throw e;
00097   }
00098 
00099   void
00100   Exception::rethrow() {
00101     throw *this;
00102   }
00103 
00104 }