From: Diane Trout Date: Wed, 21 Jun 2006 02:05:03 +0000 (+0000) Subject: use a specific exception when nextTo breaks X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=commitdiff_plain;h=f53ddd693fe894f0f6ab117a01064a9155daf5d6 use a specific exception when nextTo breaks 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? --- diff --git a/alg/conserved_path.cpp b/alg/conserved_path.cpp index c67b454..52e0c39 100644 --- a/alg/conserved_path.cpp +++ b/alg/conserved_path.cpp @@ -1,5 +1,5 @@ #include "alg/conserved_path.hpp" -#include +#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(); diff --git a/alg/conserved_path.hpp b/alg/conserved_path.hpp index 05d23c9..8683faf 100644 --- a/alg/conserved_path.hpp +++ b/alg/conserved_path.hpp @@ -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 diff --git a/mussa_exceptions.hpp b/mussa_exceptions.hpp index aa920b1..2f327b7 100644 --- a/mussa_exceptions.hpp +++ b/mussa_exceptions.hpp @@ -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