Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:04

0001 #ifndef FWCore_Framework_MakeDataException_h
0002 #define FWCore_Framework_MakeDataException_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Framework
0006 // Class  :     MakeDataException
0007 //
0008 /**\class MakeDataException MakeDataException.h FWCore/Framework/interface/MakeDataException.h
0009 
0010 Description: An exception that is thrown whenever a Provider had a problem with
0011 its algorithm.
0012 
0013  Usage:
0014 This exception will be thrown automatically if a a class that inherits from
0015 ESProductResolverTemplate<> returns 0 from its make method.
0016 
0017 If you wish to explain the reason for the error, you can throw a 
0018 MakeDataException from within your Provider
0019 E.g.
0020 \code
0021 if(outOfBoundsValue) {
0022    throw MakeDataException(" value out of bounds",
0023                            MakeDataExceptionInfo<record_type, value_type>(iDataKey));
0024 }
0025 \endcode
0026 
0027 */
0028 //
0029 // Author:      Chris Jones
0030 // Created:     Fri Apr  1 13:18:53 EST 2005
0031 //
0032 
0033 // system include files
0034 #include <string>
0035 
0036 // user include files
0037 #include "FWCore/Framework/interface/DataKey.h"
0038 #include "FWCore/Framework/interface/EventSetupRecordKey.h"
0039 #include "FWCore/Utilities/interface/Exception.h"
0040 
0041 // forward declarations
0042 namespace edm {
0043   namespace eventsetup {
0044 
0045     class MakeDataException : public cms::Exception {
0046     public:
0047       MakeDataException(const EventSetupRecordKey&, const DataKey&);
0048       ~MakeDataException() noexcept override {}
0049 
0050       // ---------- const member functions ---------------------
0051       const char* myMessage() const noexcept { return message_.c_str(); }
0052 
0053       // ---------- static member functions --------------------
0054       static std::string standardMessage(const EventSetupRecordKey&, const DataKey&);
0055       // ---------- member functions ---------------------------
0056 
0057     private:
0058       //MakeDataException(const MakeDataException&); // stop default
0059 
0060       //const MakeDataException& operator=(const MakeDataException&); // stop default
0061 
0062       // ---------- member data --------------------------------
0063       std::string message_;
0064     };
0065 
0066   }  // namespace eventsetup
0067 }  // namespace edm
0068 #endif