Skip to content

Commit

Permalink
Keep a copy of the original exception info and append it to the
Browse files Browse the repository at this point in the history
fallback file-open failure message.
  • Loading branch information
bbockelm committed Sep 3, 2013
1 parent 2ee6043 commit fb3a8b1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion IOPool/Input/src/RootInputFileSequence.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ namespace edm {
bool hasFallbackUrl = !fallbackName.empty() && fallbackName != fileIter_->fileName();

boost::shared_ptr<InputFile> filePtr;
std::list<std::string> originalInfo;
try {
std::unique_ptr<InputSource::FileOpenSentry>
sentry(inputType_ == InputType::Primary ? new InputSource::FileOpenSentry(input_, lfn_, usedFallback_) : 0);
Expand All @@ -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);
Expand All @@ -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;
}
}
Expand Down

0 comments on commit fb3a8b1

Please sign in to comment.