Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/JsError.cpp

Issue 29810586: Issue 6526 - Use the maybe version of Compile() and Run() (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: r-value CheckedToLocal Created June 21, 2018, 1:04 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/JsError.h ('k') | src/Utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
+}
« no previous file with comments | « src/JsError.h ('k') | src/Utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld