Director exceptions now derive from std::exception
This commit is contained in:
parent
af6bee1e8c
commit
cc650e692e
10 changed files with 104 additions and 73 deletions
|
|
@ -9,6 +9,7 @@
|
|||
#include <iostream>
|
||||
#endif
|
||||
#include <string>
|
||||
#include <exception>
|
||||
|
||||
namespace Swig {
|
||||
/* Director base class - not currently used in C# directors */
|
||||
|
|
@ -16,7 +17,7 @@ namespace Swig {
|
|||
};
|
||||
|
||||
/* Base class for director exceptions */
|
||||
class DirectorException {
|
||||
class DirectorException : public std::exception {
|
||||
protected:
|
||||
std::string swig_msg;
|
||||
|
||||
|
|
@ -27,16 +28,16 @@ namespace Swig {
|
|||
DirectorException(const std::string &msg) : swig_msg(msg) {
|
||||
}
|
||||
|
||||
const std::string& what() const {
|
||||
return swig_msg;
|
||||
virtual ~DirectorException() throw() {
|
||||
}
|
||||
|
||||
virtual ~DirectorException() {
|
||||
const char *what() const throw() {
|
||||
return swig_msg.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
/* Pure virtual method exception */
|
||||
class DirectorPureVirtualException : public Swig::DirectorException {
|
||||
class DirectorPureVirtualException : public DirectorException {
|
||||
public:
|
||||
DirectorPureVirtualException(const char *msg) : DirectorException(std::string("Attempt to invoke pure virtual method ") + msg) {
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue