From ba91bd53fd26d9a5de372e474d21d277239b97de Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sat, 15 Jun 2019 11:11:11 -0400 Subject: [PATCH 1/2] Add better error reporting --- gtsam.h | 2 +- wrap/Class.cpp | 44 ++++++++++++++++++++++++++++++-------------- wrap/Method.cpp | 8 ++++---- 3 files changed, 35 insertions(+), 19 deletions(-) diff --git a/gtsam.h b/gtsam.h index ba5aa5f4f..97eb2d8c3 100644 --- a/gtsam.h +++ b/gtsam.h @@ -1870,7 +1870,6 @@ class NonlinearFactorGraph { // FactorGraph void print(string s) const; - void printErrors(const gtsam::Values& values); bool equals(const gtsam::NonlinearFactorGraph& fg, double tol) const; size_t size() const; bool empty() const; @@ -1887,6 +1886,7 @@ class NonlinearFactorGraph { gtsam::KeyVector keyVector() const; // NonlinearFactorGraph + void printErrors(const gtsam::Values& values) const; double error(const gtsam::Values& values) const; double probPrime(const gtsam::Values& values) const; gtsam::Ordering orderingCOLAMD() const; diff --git a/wrap/Class.cpp b/wrap/Class.cpp index 5c1e6187e..65ce9eab7 100644 --- a/wrap/Class.cpp +++ b/wrap/Class.cpp @@ -342,17 +342,21 @@ vector Class::expandTemplate(Str templateArg, /* ************************************************************************* */ void Class::addMethod(bool verbose, bool is_const, Str methodName, - const ArgumentList& argumentList, const ReturnValue& returnValue, - const Template& tmplate) { + const ArgumentList& argumentList, + const ReturnValue& returnValue, const Template& tmplate) { // Check if templated if (tmplate.valid()) { - templateMethods_[methodName].addOverload(methodName, argumentList, - returnValue, is_const, - tmplate.argName(), verbose); + try { + templateMethods_[methodName].addOverload(methodName, argumentList, + returnValue, is_const, + tmplate.argName(), verbose); + } catch (const std::runtime_error& e) { + throw std::runtime_error("Class::addMethod: error adding " + name_ + + "::" + methodName + "\n" + e.what()); + } // Create method to expand // For all values of the template argument, create a new method - for(const Qualified& instName: tmplate.argValues()) { - + for (const Qualified& instName : tmplate.argValues()) { const TemplateSubstitution ts(tmplate.argName(), instName, *this); // substitute template in arguments ArgumentList expandedArgs = argumentList.expandTemplate(ts); @@ -361,15 +365,27 @@ void Class::addMethod(bool verbose, bool is_const, Str methodName, // Now stick in new overload stack with expandedMethodName key // but note we use the same, unexpanded methodName in overload string expandedMethodName = methodName + instName.name(); - methods_[expandedMethodName].addOverload(methodName, expandedArgs, - expandedRetVal, is_const, instName, verbose); + try { + methods_[expandedMethodName].addOverload(methodName, expandedArgs, + expandedRetVal, is_const, + instName, verbose); + } catch (const std::runtime_error& e) { + throw std::runtime_error("Class::addMethod: error adding " + name_ + + "::" + expandedMethodName + "\n" + e.what()); + } } } else { - // just add overload - methods_[methodName].addOverload(methodName, argumentList, returnValue, - is_const, boost::none, verbose); - nontemplateMethods_[methodName].addOverload(methodName, argumentList, returnValue, - is_const, boost::none, verbose); + try { + // just add overload + methods_[methodName].addOverload(methodName, argumentList, returnValue, + is_const, boost::none, verbose); + nontemplateMethods_[methodName].addOverload(methodName, argumentList, + returnValue, is_const, + boost::none, verbose); + } catch (const std::runtime_error& e) { + throw std::runtime_error("Class::addMethod: error adding " + name_ + + "::" + methodName + "\n" + e.what()); + } } } diff --git a/wrap/Method.cpp b/wrap/Method.cpp index f7247341c..2a4b0b3af 100644 --- a/wrap/Method.cpp +++ b/wrap/Method.cpp @@ -38,12 +38,12 @@ bool Method::addOverload(Str name, const ArgumentList& args, is_const_ = is_const; else if (is_const && !is_const_) throw std::runtime_error( - "Method::addOverload now designated as const whereas before it was " - "not"); + "Method::addOverload: " + name + + " now designated as const whereas before it was not"); else if (!is_const && is_const_) throw std::runtime_error( - "Method::addOverload now designated as non-const whereas before it " - "was"); + "Method::addOverload: " + name + + " now designated as non-const whereas before it was"); return first; } From 01ce03673c1f5df4d7560a0a748f75b9992b1957 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Thu, 13 Jun 2019 10:33:45 -0400 Subject: [PATCH 2/2] Excluded build that consistently times out --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b2d44a9cc..1e2d6760a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -101,9 +101,13 @@ env: script: - bash .travis.sh -t -# Exclude clang on Linux/clang in release until issue #57 is solved matrix: exclude: + # Exclude g++ debug on Linux as it consistently times out + - os: linux + compiler: gcc + env : CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF + # Exclude clang on Linux/clang in release until issue #57 is solved - os: linux compiler: clang env : CMAKE_BUILD_TYPE=Release