From fb3a8b190829389c83848f3df22ae5e793d692f0 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 3 Sep 2013 15:37:39 +0200 Subject: [PATCH] Keep a copy of the original exception info and append it to the fallback file-open failure message. --- IOPool/Input/src/RootInputFileSequence.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/IOPool/Input/src/RootInputFileSequence.cc b/IOPool/Input/src/RootInputFileSequence.cc index 3d88d84459884..53d35f14225fd 100644 --- a/IOPool/Input/src/RootInputFileSequence.cc +++ b/IOPool/Input/src/RootInputFileSequence.cc @@ -199,6 +199,7 @@ namespace edm { bool hasFallbackUrl = !fallbackName.empty() && fallbackName != fileIter_->fileName(); boost::shared_ptr filePtr; + std::list originalInfo; try { std::unique_ptr sentry(inputType_ == InputType::Primary ? new InputSource::FileOpenSentry(input_, lfn_, usedFallback_) : 0); @@ -211,6 +212,7 @@ namespace edm { out << e.explainSelf(); std::string pfn(gSystem->ExpandPathName(fallbackName.c_str())); InputFile::reportFallbackAttempt(pfn, fileIter_->logicalFileName(), out.str()); + originalInfo = e.additionalInfo(); } else { InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName()); Exception ex(errors::FileOpenError, "", e); @@ -237,7 +239,15 @@ namespace edm { std::ostringstream out; out << "Input file " << fileIter_->fileName() << " could not be opened.\n"; out << "Fallback Input file " << fallbackName << " also could not be opened."; - ex.addAdditionalInfo(out.str()); + if (originalInfo.size()) { + out << std::endl << "Original exception info is above; fallback exception info is below."; + ex.addAdditionalInfo(out.str()); + for (auto const & s : originalInfo) { + ex.addAdditionalInfo(s); + } + } else { + ex.addAdditionalInfo(out.str()); + } throw ex; } }