Skip to content
Snippets Groups Projects
Unverified Commit 2aa5f55c authored by Martyn Gigg's avatar Martyn Gigg Committed by GitHub
Browse files

Merge pull request #23007 from mantidproject/18529_ICat_exception_fix

Caught exception in ICat
parents 457061a0 dd5a22f8
No related branches found
No related tags found
No related merge requests found
......@@ -218,6 +218,19 @@ const std::map<std::string, std::string> CatalogHelper::validateProperties(
errors.emplace(iter->first + "_err", documentation);
}
}
// catch invalid date formats
std::string dateField = "StartDate";
try {
getTimevalue(catalogAlgorithm->getProperty(dateField));
dateField = "EndDate";
getTimevalue(catalogAlgorithm->getProperty(dateField));
} catch (std::invalid_argument &) {
std::string documentation =
propertyDocumentation(catalogAlgorithm->getProperties(), dateField);
errors.emplace(dateField + "_err", documentation);
}
return errors;
}
......@@ -238,6 +251,7 @@ time_t CatalogHelper::getTimevalue(const std::string &inputDate) {
std::string isoDate = dateSegments.at(2) + "-" + dateSegments.at(1) + "-" +
dateSegments.at(0) + " 00:00:00.000";
// Return the date as time_t value.
return Mantid::Types::Core::DateAndTime(isoDate).to_time_t();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment