Index: src/JsError.cpp |
=================================================================== |
--- a/src/JsError.cpp |
+++ b/src/JsError.cpp |
@@ -39,8 +39,23 @@ |
auto lineNumber = message->GetLineNumber(isolate->GetCurrentContext()); |
if (lineNumber.IsJust()) |
error << lineNumber.FromJust(); |
else |
error << "<unknown>"; |
} |
return error.str(); |
} |
+ |
+JsError::JsError(const char* message, const char* filename, int line) |
+ : std::runtime_error(ErrorToString(message, filename, line)) |
+{ |
+} |
+ |
+std::string JsError::ErrorToString(const char* message, const char* filename, int line) |
+{ |
+ std::stringstream error; |
+ error << message; |
+ error << filename; |
+ error << ":"; |
+ error << line; |
+ return error.str(); |
+} |