use a specific exception when nextTo breaks
authorDiane Trout <diane@caltech.edu>
Wed, 21 Jun 2006 02:05:03 +0000 (02:05 +0000)
committerDiane Trout <diane@caltech.edu>
Wed, 21 Jun 2006 02:05:03 +0000 (02:05 +0000)
throw conserved_path_size_mismatch, hopefully we can catch it at some point
and then reset that analysis (hopefully).

I'd like to know why it breaks?

alg/conserved_path.cpp
alg/conserved_path.hpp
mussa_exceptions.hpp

index c67b4540d986b53940f52550c3e3a1c30c695ec5..52e0c39b5a3fc8d5c686a651ddd278e0bd5af173 100644 (file)
@@ -1,5 +1,5 @@
 #include "alg/conserved_path.hpp"
-#include <stdexcept>
+#include "mussa_exceptions.hpp"
 
 using namespace std;
 
@@ -119,7 +119,7 @@ ConservedPath::const_iterator ConservedPath::end() const
 bool ConservedPath::nextTo(const ConservedPath& next) const
 {
   if (size() != next.size() ) {
-    throw runtime_error("paths must be the same length");
+    throw conserved_path_size_mismatch("paths must be the same length");
   }    
   ConservedPath::const_iterator this_itor = begin();
   ConservedPath::const_iterator next_itor = next.begin();
index 05d23c91f5205c171156ed27b2328509f1092aeb..8683faf6f3c8e6a27d2f78eed9344ff70d5e51ba 100644 (file)
@@ -34,6 +34,7 @@ struct ConservedPath
   //! return true if all elements of the path are "next to" our current path.
   /*! Next to is defined as being window index + 1
    *  that definition may not properly track reverse compliment
+   *  \throws conserved_path_size_mismatch
    */
   bool nextTo(const ConservedPath& next) const;
   //! indicate which elements of the path are reversed
index aa920b1afda7fb157fcfab4b2d489453184b7825..2f327b73859a54c579ad9bee64939ff18c81eb4f 100644 (file)
@@ -64,4 +64,12 @@ public:
   explicit motif_normalize_error(const std::string& msg) : 
     mussa_error(msg) {};
 };
+
+//! ConservedPath::nextTo had two paths that weren't the same size
+class conserved_path_size_mismatch : public mussa_error
+{
+public:
+  explicit conserved_path_size_mismatch(const std::string& msg) :
+    mussa_error(msg) {};
+};
 #endif