23 #include "pybind11/pybind11.h" 41 py::module::import(
"lsst.pex.exceptions");
43 auto clsFatalAlgorithmError =
44 declareException<FatalAlgorithmError, RuntimeError>(mod,
"FatalAlgorithmError",
"RuntimeError");
45 auto clsMeasurementError =
46 declareException<MeasurementError, RuntimeError>(mod,
"MeasurementError",
"RuntimeError");
47 auto clsPixelValueError =
48 declareException<PixelValueError, DomainError>(mod,
"PixelValueError",
"DomainError");
50 clsMeasurementError.def(py::init<std::string const &, std::size_t>(),
"message"_a,
"flagBit"_a);
51 clsFatalAlgorithmError.def(py::init<std::string const &>(),
"message"_a);
52 clsPixelValueError.def(py::init<std::string const &>(),
"message"_a);
54 clsMeasurementError.def(
"getFlagBit", &MeasurementError::getFlagBit);
pybind11::class_< T, E > declareException(pybind11::module &mod, const std::string &name, const std::string &base)
Helper function for pybind11, used to define new types of exceptions.
Reports arguments outside the domain of an operation.
A base class for image defects.
PYBIND11_MODULE(exceptions, mod)
Reports errors that are due to events beyond the control of the program.