MCPcopy Create free account
hub / github.com/pybind/pybind11 / MyException

Class MyException

tests/test_exceptions.cpp:21–28  ·  view source on GitHub ↗

A type that should be raised as an exception in Python

Source from the content-addressed store, hash-verified

19
20// A type that should be raised as an exception in Python
21class MyException : public std::exception {
22public:
23 explicit MyException(const char *m) : message{m} {}
24 const char *what() const noexcept override { return message.c_str(); }
25
26private:
27 std::string message = "";
28};
29
30class MyExceptionUseDeprecatedOperatorCall : public MyException {
31 using MyException::MyException;

Callers 1

TEST_SUBMODULEFunction · 0.85

Calls

no outgoing calls

Tested by 1

TEST_SUBMODULEFunction · 0.68