From da39416d86603aeb9cf4062e71aa818db40426a7 Mon Sep 17 00:00:00 2001 From: Gerardo Tauriello <gerardo.tauriello@unibas.ch> Date: Mon, 6 Nov 2017 14:53:33 +0100 Subject: [PATCH] SCHWED-2893: graceful exception handling for invalid fragdb queries --- loop/src/frag_db.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/loop/src/frag_db.cc b/loop/src/frag_db.cc index 91369cdd..e69cf20f 100644 --- a/loop/src/frag_db.cc +++ b/loop/src/frag_db.cc @@ -289,10 +289,17 @@ void FragDB::SearchDB(const StemCoordPair& stems, std::vector<FragmentInfo>& fragments, uint extra_bins) { - std::vector<StemPairGeom> stem_pairs = MakeStemPairGeom(stems.first, - stems.second, - frag_size, - extra_bins); + std::vector<StemPairGeom> stem_pairs; + try { + stem_pairs = MakeStemPairGeom(stems.first, stems.second, frag_size, + extra_bins); + } catch (const promod3::Error&) { + // MakeStemPairGeom can fail if distance bin is out of bounds + // -> this is ok here as it simply means that we have no fitting fragments + // in this FragDB + // => silently ignore and keep fragments vector unchanged + return; + } for(std::vector<StemPairGeom>::iterator it = stem_pairs.begin(); it != stem_pairs.end(); ++it){ -- GitLab