Make EvalError a subclass of runtime_error and provide the std::exception with a robust description for easier debugging of callback/scripted function calls
This commit is contained in:
@@ -15,11 +15,16 @@ namespace chaiscript
|
||||
ParserError(const std::string &why, const langkit::TokenPtr where) : reason(why), location(where){ }
|
||||
};
|
||||
|
||||
struct EvalError {
|
||||
struct EvalError : public std::runtime_error {
|
||||
std::string reason;
|
||||
langkit::TokenPtr location;
|
||||
|
||||
EvalError(const std::string &why, const langkit::TokenPtr where) : reason(why), location(where) { }
|
||||
EvalError(const std::string &why, const langkit::TokenPtr where)
|
||||
: std::runtime_error("Eval error: \"" + why + "\" in '"
|
||||
+ where->filename + "' line: " + boost::lexical_cast<std::string>(where->start.line+1)),
|
||||
reason(why), location(where) { }
|
||||
|
||||
virtual ~EvalError() throw() {}
|
||||
};
|
||||
|
||||
struct ReturnValue {
|
||||
|
Reference in New Issue
Block a user