Index: src/JsError.cpp |
=================================================================== |
--- a/src/JsError.cpp |
+++ b/src/JsError.cpp |
@@ -38,9 +38,24 @@ |
auto maybeLineNumber = message->GetLineNumber(isolate->GetCurrentContext()); |
int lineNumber = 0; |
if (maybeLineNumber.To(&lineNumber)) |
error << lineNumber; |
else |
error << "unknown line"; |
} |
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(); |
+} |