From e9c6f468b99a2b0e19d90bceb804c2dabecfc40d Mon Sep 17 00:00:00 2001
From: Valerio Mariani <valerio.mariani@unibas.ch>
Date: Tue, 3 Jul 2012 11:35:34 +0200
Subject: [PATCH] Exceptions raised during the structure quality checks are now
 caught

---
 modules/mol/alg/src/lddt.cc | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/modules/mol/alg/src/lddt.cc b/modules/mol/alg/src/lddt.cc
index 7405d993f..214298904 100644
--- a/modules/mol/alg/src/lddt.cc
+++ b/modules/mol/alg/src/lddt.cc
@@ -325,10 +325,22 @@ int main (int argc, char **argv)
         exit(-1);
       }
       // performs structural checks and filters the structure   
-      v=alg::CheckStereoChemistry(v,bond_table,angle_table,bond_tolerance,angle_tolerance);
+      try { 
+        v=alg::CheckStereoChemistry(v,bond_table,angle_table,bond_tolerance,angle_tolerance);
+      } catch (std::exception& e) {       
+        std::cout << "An error occurred during the structure quality checks, stage 1:" << std::endl;    
+        std::cout << e.what() << std::endl;
+        exit(-1);
+      }
       cov = compute_coverage(v,glob_dist_list);
       std::cout << "Coverage after stereo-chemical checks: " << (float(cov.first)/float(cov.second)) << " (" << cov.first << " out of " << cov.second << " residues)" << std::endl;
-      v=alg::FilterClashes(v,nonbonded_table);
+      try {
+        v=alg::FilterClashes(v,nonbonded_table);
+      } catch (std::exception& e) {       
+        std::cout << "An error occurred during the structure quality checks, stage 2:" << std::endl;    
+        std::cout << e.what() << std::endl;
+        exit(-1);
+      }
       cov = compute_coverage(v,glob_dist_list);
       std::cout << "Coverage after clashing checks: " << (float(cov.first)/float(cov.second)) << " (" << cov.first << " out of " << cov.second << " residues)" << std::endl;
     }
-- 
GitLab