91 py::class_<Tracepoint> clsTracepoint(mod,
"Tracepoint");
93 clsTracepoint.def(py::init<char const *, int, char const *, std::string const &>())
94 .def_readwrite(
"_file", &Tracepoint::_file)
95 .def_readwrite(
"_line", &Tracepoint::_line)
96 .def_readwrite(
"_func", &Tracepoint::_func)
97 .def_readwrite(
"_message", &Tracepoint::_message);
99 py::class_<Exception> clsException(mod,
"Exception");
101 clsException.def(py::init<std::string const &>())
102 .def(
"addMessage", &Exception::addMessage)
103 .def(
"getTraceback", &Exception::getTraceback)
104 .def(
"addToStream", &Exception::addToStream)
105 .def(
"what", &Exception::what)
106 .def(
"getType", &Exception::getType)
111 self.addToStream(stream);
116 s <<
"Exception('" <<
self.what() <<
"')";
120 py::class_<LogicError, Exception> clsLogicError(mod,
"LogicError");
121 clsLogicError.def(py::init<std::string const &>());
123 py::class_<NotFoundError, Exception> clsNotFoundError(mod,
"NotFoundError");
124 clsNotFoundError.def(py::init<std::string const &>());
126 py::class_<RuntimeError, Exception> clsRuntimeError(mod,
"RuntimeError");
127 clsRuntimeError.def(py::init<std::string const &>());
129 py::class_<IoError, RuntimeError> clsIoError(mod,
"IoError");
130 clsIoError.def(py::init<std::string const &>());
132 py::class_<OverflowError, RuntimeError> clsOverflowError(mod,
"OverflowError");
133 clsOverflowError.def(py::init<std::string const &>());
135 py::class_<RangeError, RuntimeError> clsRangeError(mod,
"RangeError");
136 clsRangeError.def(py::init<std::string const &>());
138 py::class_<TypeError, LogicError> clsTypeError(mod,
"TypeError");
139 clsTypeError.def(py::init<std::string const &>());
141 py::class_<UnderflowError, RuntimeError> clsUnderflowError(mod,
"UnderflowError");
142 clsUnderflowError.def(py::init<std::string const &>());
144 py::class_<DomainError, LogicError> clsDomainError(mod,
"DomainError");
145 clsDomainError.def(py::init<std::string const &>());
147 py::class_<InvalidParameterError, LogicError> clsInvalidParameterError(mod,
"InvalidParameterError");
148 clsInvalidParameterError.def(py::init<std::string const &>());
150 py::class_<LengthError, LogicError> clsLengthError(mod,
"LengthError");
151 clsLengthError.def(py::init<std::string const &>());
153 py::class_<OutOfRangeError, LogicError> clsOutOfRangeError(mod,
"OutOfRangeError");
154 clsOutOfRangeError.def(py::init<std::string const &>());
160 py::object current_exception;
161 current_exception = py::cast(e.
clone(), py::return_value_policy::take_ownership);
162 raiseLsstException(current_exception);
Provides consistent interface for LSST exceptions.
virtual Exception * clone(void) const
Return a copy of the exception as an Exception pointer.
T rethrow_exception(T... args)