Skip to content

Commit

Permalink
Improve error msg for UnitVector3d.__getstate__
Browse files Browse the repository at this point in the history
  • Loading branch information
r-owen committed Jul 24, 2018
1 parent e61e6fe commit 0e48d00
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/lsst/sphgeom/unitVector3d.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "pybind11/pybind11.h"

#include <memory>
#include <string>

#include "lsst/sphgeom/Angle.h"
#include "lsst/sphgeom/LonLat.h"
Expand Down Expand Up @@ -120,7 +121,8 @@ PYBIND11_MODULE(unitVector3d, mod) {
cls.def(py::pickle([](UnitVector3d const &self) { return py::make_tuple(self.x(), self.y(), self.z()); },
[](py::tuple t) {
if (t.size() != 3) {
throw std::runtime_error("Invalid state!");
throw std::runtime_error("Tuple size = " + std::to_string(t.size()) +
"; must be 3 for a UnitVector3d");
}
return new UnitVector3d(UnitVector3d::fromNormalized(
t[0].cast<double>(), t[1].cast<double>(), t[2].cast<double>()));
Expand Down

0 comments on commit 0e48d00

Please sign in to comment.