Commit ca9c8318 authored by Tiago Peixoto's avatar Tiago Peixoto

Fix bug in ActionNotFound exception handling

parent 61421243
...@@ -4,7 +4,11 @@ dnl graph-tool package version number ...@@ -4,7 +4,11 @@ dnl graph-tool package version number
m4_define(graph_tool_version_major, 2) m4_define(graph_tool_version_major, 2)
m4_define(graph_tool_version_minor, 13dev) m4_define(graph_tool_version_minor, 13dev)
AC_INIT([graph-tool],[graph_tool_version_major().graph_tool_version_minor()],[http://graph-tool.skewed.de/tickets], [graph-tool], [http://graph-tool.skewed.de]) AC_INIT([graph-tool],
[graph_tool_version_major().graph_tool_version_minor()],
[http://graph-tool.skewed.de/issues],
[graph-tool],
[http://graph-tool.skewed.de])
GRAPH_TOOL_VERSION_MAJOR=graph_tool_version_major() GRAPH_TOOL_VERSION_MAJOR=graph_tool_version_major()
GRAPH_TOOL_VERSION_MINOR=graph_tool_version_minor() GRAPH_TOOL_VERSION_MINOR=graph_tool_version_minor()
......
...@@ -172,9 +172,6 @@ void graph_exception_translator(const Exception& e) ...@@ -172,9 +172,6 @@ void graph_exception_translator(const Exception& e)
error = PyExc_IOError; error = PyExc_IOError;
if (std::is_same<Exception, ValueException>::value) if (std::is_same<Exception, ValueException>::value)
error = PyExc_ValueError; error = PyExc_ValueError;
PyObject* message = PyUnicode_FromString(e.what());
PyObject_SetAttrString(error, "message", message);
PyErr_SetString(error, e.what()); PyErr_SetString(error, e.what());
} }
......
...@@ -23,7 +23,6 @@ using namespace graph_tool; ...@@ -23,7 +23,6 @@ using namespace graph_tool;
GraphException::GraphException(const string& error) {_error = error;} GraphException::GraphException(const string& error) {_error = error;}
GraphException::~GraphException() throw () {} GraphException::~GraphException() throw () {}
const char * GraphException::what () const throw () {return _error.c_str();} const char * GraphException::what () const throw () {return _error.c_str();}
void GraphException::SetError(const string& error) {_error = error;}
IOException::IOException(const string& error): GraphException(error) {} IOException::IOException(const string& error): GraphException(error) {}
IOException::~IOException() throw () {} IOException::~IOException() throw () {}
......
...@@ -36,8 +36,6 @@ public: ...@@ -36,8 +36,6 @@ public:
virtual ~GraphException() throw (); virtual ~GraphException() throw ();
virtual const char * what () const throw (); virtual const char * what () const throw ();
protected: protected:
virtual void SetError(const string& error);
private:
string _error; string _error;
}; };
......
...@@ -43,25 +43,21 @@ string name_demangle(string name) ...@@ -43,25 +43,21 @@ string name_demangle(string name)
// Whenever no implementation is called, the following exception is thrown // Whenever no implementation is called, the following exception is thrown
graph_tool::ActionNotFound::ActionNotFound(const type_info& action, graph_tool::ActionNotFound::ActionNotFound(const type_info& action,
const vector<const type_info*>& args) const vector<const type_info*>& args)
: GraphException(""), _action(action), _args(args) {} : GraphException(""), _action(action), _args(args)
const char * graph_tool::ActionNotFound::what () const throw ()
{ {
using python::detail::gcc_demangle; using python::detail::gcc_demangle;
string error = _error =
"No static implementation was found for the desired routine. " "No static implementation was found for the desired routine. "
"This is a graph_tool bug. :-( Please follow bug report " "This is a graph_tool bug. :-( Please submit a bug report at "
"instructions at " PACKAGE_BUGREPORT ". What follows is debug " PACKAGE_BUGREPORT ". What follows is debug information.\n\n";
"information.\n\n";
error += "Action: " + name_demangle(_action.name()) + "\n\n"; _error += "Action: " + name_demangle(_action.name()) + "\n\n";
for (size_t i = 0; i < _args.size(); ++i) for (size_t i = 0; i < _args.size(); ++i)
{ {
error += "Arg " + lexical_cast<string>(i+1) + ": " + _error += "Arg " + lexical_cast<string>(i+1) + ": " +
name_demangle(_args[i]->name()) + "\n\n"; name_demangle(_args[i]->name()) + "\n\n";
} }
return error.c_str();
} }
// this will check whether a graph is reversed and return the proper view // this will check whether a graph is reversed and return the proper view
......
...@@ -116,7 +116,6 @@ class ActionNotFound: public GraphException ...@@ -116,7 +116,6 @@ class ActionNotFound: public GraphException
public: public:
ActionNotFound(const std::type_info& action, ActionNotFound(const std::type_info& action,
const vector<const std::type_info*>& args); const vector<const std::type_info*>& args);
virtual const char * what () const throw ();
virtual ~ActionNotFound() throw () {} virtual ~ActionNotFound() throw () {}
private: private:
const std::type_info& _action; const std::type_info& _action;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment