"docs/source/vscode:/vscode.git/clone" did not exist on "ef4c2fa4f1cfaebab186d8007923ab129d219bd3"
Commit 555fb5c3 authored by Jesse Beder's avatar Jesse Beder
Browse files

Fixed the Exception::what() function

parent 2160bb2b
...@@ -61,16 +61,19 @@ namespace YAML ...@@ -61,16 +61,19 @@ namespace YAML
class Exception: public std::exception { class Exception: public std::exception {
public: public:
Exception(int line_, int column_, const std::string& msg_) Exception(int line_, int column_, const std::string& msg_)
: line(line_), column(column_), msg(msg_) {} : line(line_), column(column_), msg(msg_) {
std::stringstream output;
output << "Error at line " << line+1 << ", column " << column+1 << ": " << msg;
what_ = output.str();
}
virtual ~Exception() throw() {} virtual ~Exception() throw() {}
virtual const char *what() const throw() { virtual const char *what() const throw() { return what_.c_str(); }
std::stringstream output;
output << "Error at line " << line+1 << ", column " << column+1 << ": " << msg;
return output.str().c_str();
}
int line, column; int line, column;
std::string msg; std::string msg;
private:
std::string what_;
}; };
class ParserException: public Exception { class ParserException: public Exception {
......
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