Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:36:26

0001 
0002 #include "FWCore/Utilities/interface/EDMException.h"
0003 
0004 #define FILLENTRY(name) {name, #name}
0005 
0006 namespace edm {
0007   namespace errors {
0008     static const std::map<ErrorCodes, std::string> codeMap = {FILLENTRY(CommandLineProcessing),
0009                                                               FILLENTRY(ConfigFileNotFound),
0010                                                               FILLENTRY(ConfigFileReadError),
0011                                                               FILLENTRY(OtherCMS),
0012                                                               FILLENTRY(StdException),
0013                                                               FILLENTRY(Unknown),
0014                                                               FILLENTRY(BadAlloc),
0015                                                               FILLENTRY(BadExceptionType),
0016                                                               FILLENTRY(ProductNotFound),
0017                                                               FILLENTRY(DictionaryNotFound),
0018                                                               FILLENTRY(NoProductSpecified),
0019                                                               FILLENTRY(InsertFailure),
0020                                                               FILLENTRY(Configuration),
0021                                                               FILLENTRY(LogicError),
0022                                                               FILLENTRY(UnimplementedFeature),
0023                                                               FILLENTRY(InvalidReference),
0024                                                               FILLENTRY(NullPointerError),
0025                                                               FILLENTRY(EventTimeout),
0026                                                               FILLENTRY(EventCorruption),
0027                                                               FILLENTRY(ScheduleExecutionFailure),
0028                                                               FILLENTRY(EventProcessorFailure),
0029                                                               FILLENTRY(FileInPathError),
0030                                                               FILLENTRY(FileOpenError),
0031                                                               FILLENTRY(FileReadError),
0032                                                               FILLENTRY(FatalRootError),
0033                                                               FILLENTRY(MismatchedInputFiles),
0034                                                               FILLENTRY(ProductDoesNotSupportViews),
0035                                                               FILLENTRY(ProductDoesNotSupportPtr),
0036                                                               FILLENTRY(NotFound),
0037                                                               FILLENTRY(FormatIncompatibility),
0038                                                               FILLENTRY(FallbackFileOpenError),
0039                                                               FILLENTRY(NoSecondaryFiles),
0040                                                               FILLENTRY(ExceededResourceVSize),
0041                                                               FILLENTRY(ExceededResourceRSS),
0042                                                               FILLENTRY(ExceededResourceTime),
0043                                                               FILLENTRY(FileWriteError),
0044                                                               FILLENTRY(FileNameInconsistentWithGUID),
0045                                                               FILLENTRY(UnavailableAccelerator),
0046                                                               FILLENTRY(ExternalFailure),
0047                                                               FILLENTRY(EventGenerationFailure),
0048                                                               FILLENTRY(UnexpectedJobTermination),
0049                                                               FILLENTRY(CaughtSignal)};
0050     static const std::string kUnknownCode("unknownCode");
0051   }  // namespace errors
0052   /// -------------- implementation details ------------------
0053 
0054   const std::string& Exception::codeToString(errors::ErrorCodes c) {
0055     auto i(errors::codeMap.find(c));
0056     return i != errors::codeMap.end() ? i->second : errors::kUnknownCode;
0057   }
0058 
0059   Exception::Exception(errors::ErrorCodes aCategory) : cms::Exception(codeToString(aCategory)), category_(aCategory) {}
0060 
0061   Exception::Exception(errors::ErrorCodes aCategory, std::string const& message)
0062       : cms::Exception(codeToString(aCategory), message), category_(aCategory) {}
0063 
0064   Exception::Exception(errors::ErrorCodes aCategory, char const* message)
0065       : cms::Exception(codeToString(aCategory), std::string(message)), category_(aCategory) {}
0066 
0067   Exception::Exception(errors::ErrorCodes aCategory, std::string const& message, cms::Exception const& another)
0068       : cms::Exception(codeToString(aCategory), message, another), category_(aCategory) {}
0069 
0070   Exception::Exception(errors::ErrorCodes aCategory, char const* message, cms::Exception const& another)
0071       : cms::Exception(codeToString(aCategory), std::string(message), another), category_(aCategory) {}
0072 
0073   Exception::Exception(Exception const& other) : cms::Exception(other), category_(other.category_) {}
0074 
0075   Exception::~Exception() noexcept {}
0076 
0077   Exception& Exception::operator=(Exception const& other) {
0078     Exception temp(other);
0079     this->swap(temp);
0080     return *this;
0081   }
0082 
0083   int Exception::returnCode_() const { return static_cast<int>(category_); }
0084 
0085   void Exception::throwThis(errors::ErrorCodes aCategory,
0086                             char const* message0,
0087                             char const* message1,
0088                             char const* message2,
0089                             char const* message3,
0090                             char const* message4) {
0091     Exception e(aCategory, std::string(message0));
0092     e << message1 << message2 << message3 << message4;
0093     throw e;
0094   }
0095 
0096   void Exception::throwThis(errors::ErrorCodes aCategory, char const* message0, int intVal, char const* message1) {
0097     Exception e(aCategory, std::string(message0));
0098     e << intVal << message1;
0099     throw e;
0100   }
0101 
0102   Exception* Exception::clone() const { return new Exception(*this); }
0103 
0104   void Exception::rethrow() { throw *this; }
0105 }  // namespace edm