Improved error message

release/4.3a0
dellaert 2014-11-04 15:43:32 +01:00
parent 4afe132b1a
commit dce8a6c341
1 changed files with 5 additions and 1 deletions

View File

@ -18,6 +18,7 @@
#include <gtsam/nonlinear/NonlinearFactor.h>
#include <boost/make_shared.hpp>
#include <boost/format.hpp>
namespace gtsam {
@ -79,7 +80,10 @@ bool NoiseModelFactor::equals(const NonlinearFactor& f, double tol) const {
static void check(const SharedNoiseModel& noiseModel, size_t m) {
if (noiseModel && m != noiseModel->dim())
throw std::invalid_argument(
"NoiseModelFactor was created with a NoiseModel of incorrect dimension.");
boost::str(
boost::format(
"NoiseModelFactor: NoiseModel has dimension %1% instead of %2%.")
% noiseModel->dim() % m));
}
/* ************************************************************************* */