Director exceptions now derive from std::exception

This commit is contained in:
William S Fulton 2014-01-20 19:40:52 +00:00
commit cc650e692e
10 changed files with 104 additions and 73 deletions

View file

@ -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) {
}