Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-24 02:12:45

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