Skip to content

Commit

Permalink
Improve error message for GIDs out of range in report (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
NadirRoGue authored Jan 26, 2021
1 parent d4041e6 commit 13c1e6d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
4 changes: 0 additions & 4 deletions brion/plugin/compartmentReportBinary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,10 +585,6 @@ void CompartmentReportBinary::updateMapping(const GIDSet& gids)
return;

const GIDSet intersection = _computeIntersection(_originalGIDs, _gids);
if (intersection.empty())
{
BRION_THROW("CompartmentReportBinary::updateMapping: GIDs out of range")
}
if (intersection != _gids)
{
updateMapping(intersection);
Expand Down
18 changes: 10 additions & 8 deletions brion/plugin/compartmentReportCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,18 @@ GIDSet CompartmentReportCommon::_computeIntersection(const GIDSet& all,
std::inserter(intersection, intersection.begin()));
if (intersection != subset || intersection.empty())
{
BRION_WARN << "Requested " << subset.size() << " GIDs [" << *subset.begin()
<< ":" << *subset.rbegin() << "] are not a subset of the "
<< all.size() << " GIDs in the report [" << *all.begin() << ":"
<< *all.rbegin();
std::stringstream ss;
ss << "Requested " << subset.size() << " GIDs [" << *subset.begin()
<< ":" << *subset.rbegin() << "] are not a subset of the "
<< all.size() << " GIDs in the report [" << *all.begin() << ":"
<< *all.rbegin() << "]";
if (intersection.empty())
BRION_WARN << " with no GIDs in common" << std::endl;
BRION_THROW(ss.str())
else
BRION_WARN << "], using intersection size " << intersection.size()
<< " [" << *intersection.begin() << ":"
<< *intersection.rbegin() << "]" << std::endl;
BRION_WARN << ss.str() << std::endl
<< "Using intersection size " << intersection.size()
<< " [" << *intersection.begin() << ":"
<< *intersection.rbegin() << "]" << std::endl;
}
return intersection;
}
Expand Down
4 changes: 0 additions & 4 deletions brion/plugin/compartmentReportHDF5Sonata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,10 +680,6 @@ void CompartmentReportHDF5Sonata::_updateMapping(const GIDSet& gids)
return;

const GIDSet intersection = _computeIntersection(_sourceGIDs, gids);
if (intersection.empty())
{
BRION_THROW("CompartmentReportBinary::updateMapping: GIDs out of range")
}
if (intersection != gids)
{
_updateMapping(intersection);
Expand Down

0 comments on commit 13c1e6d

Please sign in to comment.