Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DataFormats/Common/interface/ConvertHandle.h"
0002 #include "FWCore/Utilities/interface/EDMException.h"
0003 #include "DataFormats/Common/interface/FunctorHandleExceptionFactory.h"
0004 
0005 namespace edm {
0006   namespace handleimpl {
0007     static std::shared_ptr<HandleExceptionFactory const> const s_invalidRefFactory =
0008         makeHandleExceptionFactory([]() -> std::shared_ptr<cms::Exception> {
0009           std::shared_ptr<cms::Exception> whyFailed =
0010               std::make_shared<edm::Exception>(errors::InvalidReference, "NullPointer");
0011           *whyFailed << "Handle has null pointer to data product";
0012           return whyFailed;
0013         });
0014 
0015     std::shared_ptr<HandleExceptionFactory const> makeInvalidReferenceException() { return s_invalidRefFactory; }
0016 
0017     void throwConvertTypeError(std::type_info const& expected, std::type_info const& actual) {
0018       throw Exception(errors::LogicError, "TypeMismatch")
0019           << "edm::BasicHandle contains a product of type " << actual.name() << ".\n"
0020           << "A type of " << expected.name() << "was expected.";
0021     }
0022   }  // namespace handleimpl
0023 }  // namespace edm