From ec4cfb8333d0f22016b8fd23172e59e3dd6d4c59 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Tue, 19 Dec 2023 00:08:22 +0100 Subject: [PATCH] Fix bug related to cmsRun exit code with FileReadError, 13_2_X backport --- FWCore/Framework/src/ProductResolvers.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/FWCore/Framework/src/ProductResolvers.cc b/FWCore/Framework/src/ProductResolvers.cc index 61285158f5c9b..2652fa25c45e8 100644 --- a/FWCore/Framework/src/ProductResolvers.cc +++ b/FWCore/Framework/src/ProductResolvers.cc @@ -159,13 +159,12 @@ namespace edm { } namespace { - cms::Exception& extendException(cms::Exception& e, BranchDescription const& bd, ModuleCallingContext const* mcc) { + void extendException(cms::Exception& e, BranchDescription const& bd, ModuleCallingContext const* mcc) { e.addContext(std::string("While reading from source ") + bd.className() + " " + bd.moduleLabel() + " '" + bd.productInstanceName() + "' " + bd.processName()); if (mcc) { edm::exceptionContext(e, *mcc); } - return e; } } // namespace ProductResolverBase::Resolution DelayedReaderInputProductResolver::resolveProduct_( @@ -197,10 +196,12 @@ namespace edm { //another thread could have beaten us here setProduct(reader->getProduct(branchDescription().branchID(), &principal, mcc)); } catch (cms::Exception& e) { - throw extendException(e, branchDescription(), mcc); + extendException(e, branchDescription(), mcc); + throw; } catch (std::exception const& e) { auto newExcept = edm::Exception(errors::StdException) << e.what(); - throw extendException(newExcept, branchDescription(), mcc); + extendException(newExcept, branchDescription(), mcc); + throw newExcept; } } } @@ -299,10 +300,12 @@ namespace edm { //another thread could have finished this while we were waiting setProduct(reader->getProduct(branchDescription().branchID(), &principal, mcc)); } catch (cms::Exception& e) { - throw extendException(e, branchDescription(), mcc); + extendException(e, branchDescription(), mcc); + throw; } catch (std::exception const& e) { auto newExcept = edm::Exception(errors::StdException) << e.what(); - throw extendException(newExcept, branchDescription(), mcc); + extendException(newExcept, branchDescription(), mcc); + throw newExcept; } } }