File indexing completed on 2024-04-06 12:13:13
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(ExternalFailure),
0048 FILLENTRY(EventGenerationFailure),
0049 FILLENTRY(UnexpectedJobTermination),
0050 FILLENTRY(CaughtSignal)};
0051 static const std::string kUnknownCode("unknownCode");
0052 }
0053
0054
0055 const std::string& Exception::codeToString(errors::ErrorCodes c) {
0056 auto i(errors::codeMap.find(c));
0057 return i != errors::codeMap.end() ? i->second : errors::kUnknownCode;
0058 }
0059
0060 Exception::Exception(errors::ErrorCodes aCategory) : cms::Exception(codeToString(aCategory)), category_(aCategory) {}
0061
0062 Exception::Exception(errors::ErrorCodes aCategory, std::string const& message)
0063 : cms::Exception(codeToString(aCategory), message), category_(aCategory) {}
0064
0065 Exception::Exception(errors::ErrorCodes aCategory, char const* message)
0066 : cms::Exception(codeToString(aCategory), std::string(message)), category_(aCategory) {}
0067
0068 Exception::Exception(errors::ErrorCodes aCategory, std::string const& message, cms::Exception const& another)
0069 : cms::Exception(codeToString(aCategory), message, another), category_(aCategory) {}
0070
0071 Exception::Exception(errors::ErrorCodes aCategory, char const* message, cms::Exception const& another)
0072 : cms::Exception(codeToString(aCategory), std::string(message), another), category_(aCategory) {}
0073
0074 Exception::Exception(Exception const& other) : cms::Exception(other), category_(other.category_) {}
0075
0076 Exception::~Exception() noexcept {}
0077
0078 Exception& Exception::operator=(Exception const& other) {
0079 Exception temp(other);
0080 this->swap(temp);
0081 return *this;
0082 }
0083
0084 int Exception::returnCode_() const { return static_cast<int>(category_); }
0085
0086 void Exception::throwThis(errors::ErrorCodes aCategory,
0087 char const* message0,
0088 char const* message1,
0089 char const* message2,
0090 char const* message3,
0091 char const* message4) {
0092 Exception e(aCategory, std::string(message0));
0093 e << message1 << message2 << message3 << message4;
0094 throw e;
0095 }
0096
0097 void Exception::throwThis(errors::ErrorCodes aCategory, char const* message0, int intVal, char const* message1) {
0098 Exception e(aCategory, std::string(message0));
0099 e << intVal << message1;
0100 throw e;
0101 }
0102
0103 Exception* Exception::clone() const { return new Exception(*this); }
0104
0105 void Exception::rethrow() { throw *this; }
0106 }