Skip to content

Commit

Permalink
improve exception handling in InputFileCatalog::init
Browse files Browse the repository at this point in the history
  • Loading branch information
nhduongvn committed Apr 25, 2020
1 parent cad7695 commit 0ceff5b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions FWCore/Catalog/src/InputFileCatalog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ namespace edm {
fileLocators_.clear();

for (auto it = tmp_dataCatalogs.begin(); it != tmp_dataCatalogs.end(); ++it) {
try {
//require the first file locator to success so obvious mistakes in data catalogs, typos for example, can be catched early
if (it == tmp_dataCatalogs.begin()) {
fileLocators_.push_back(std::make_unique<FileLocator>(*it));
} catch (cms::Exception const& e) {
//try all data catalogs but none work so throw exception
if (std::next(it) == tmp_dataCatalogs.end()) {
throw cms::Exception("TrivialFileCatalog",
"edm::InputFileCatalog: none of data catalogs are valid to make a FileLocator");
} else {
try {
fileLocators_.push_back(std::make_unique<FileLocator>(*it));
} catch (cms::Exception const& e) {
continue;
}
continue;
}
}

Expand Down

0 comments on commit 0ceff5b

Please sign in to comment.