Skip to content

Commit

Permalink
Merge pull request #43603 from wddgit/fixExitCode130X
Browse files Browse the repository at this point in the history
Fix bug related to cmsRun exit code with FileReadError, 13_0_X backport
  • Loading branch information
cmsbuild authored Dec 19, 2023
2 parents 4c47ab0 + 0f772e2 commit e43a7a8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions FWCore/Framework/src/ProductResolvers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_(
Expand Down Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit e43a7a8

Please sign in to comment.