File tree 3 files changed +27
-0
lines changed
3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,21 @@ namespace bob {
89
89
mutable std::string m_message;
90
90
};
91
91
92
+
93
+ /* *
94
+ * A NotImplementedError is raised when a specific function of a class
95
+ * is only implementable in certain subclasses, but not in the current one.
96
+ */
97
+ class NotImplementedError : public Exception {
98
+
99
+ public:
100
+ NotImplementedError (const std::string& reason = " This function cannot be implemented in this class" ) throw ();
101
+ virtual ~NotImplementedError () throw ();
102
+ virtual const char * what () const throw();
103
+
104
+ private:
105
+ std::string m_reason;
106
+ };
92
107
}
93
108
94
109
}
Original file line number Diff line number Diff line change @@ -58,3 +58,14 @@ const char* bob::core::DeprecationError::what() const throw() {
58
58
}
59
59
}
60
60
61
+ bob::core::NotImplementedError::NotImplementedError (const std::string& reason) throw()
62
+ : m_reason(reason)
63
+ {}
64
+
65
+ bob::core::NotImplementedError::~NotImplementedError () throw () {
66
+ }
67
+
68
+ const char * bob::core::NotImplementedError::what () const throw() {
69
+ return m_reason.c_str ();
70
+ }
71
+
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ void bind_core_exception() {
54
54
register_exception_translator<std::underflow_error>(PyExc_ArithmeticError);
55
55
56
56
register_exception_translator<bob::core::Exception>(PyExc_RuntimeError);
57
+ register_exception_translator<bob::core::NotImplementedError>(PyExc_NotImplementedError);
57
58
58
59
// note: only register exceptions to which you need specific behavior not
59
60
// covered by catching RuntimeError
You can’t perform that action at this time.
0 commit comments