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

Side by Side 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: Change the function to check MaybeLocal<> Created June 20, 2018, 4:08 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« src/JsEngine.cpp ('K') | « src/JsError.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 25 matching lines...) Expand all
36 error << *v8::String::Utf8Value(isolate, message->GetScriptResourceName()); 36 error << *v8::String::Utf8Value(isolate, message->GetScriptResourceName());
37 error << ":"; 37 error << ":";
38 auto maybeLineNumber = message->GetLineNumber(isolate->GetCurrentContext()); 38 auto maybeLineNumber = message->GetLineNumber(isolate->GetCurrentContext());
39 int lineNumber = 0; 39 int lineNumber = 0;
40 if (maybeLineNumber.To(&lineNumber)) 40 if (maybeLineNumber.To(&lineNumber))
41 error << lineNumber; 41 error << lineNumber;
42 else 42 else
43 error << "unknown line"; 43 error << "unknown line";
44 } 44 }
45 return error.str(); 45 return error.str();
46 } 46 }
47
48 JsError::JsError(const char* message, const char* filename, int line)
49 : std::runtime_error(ErrorToString(message, filename, line))
50 {
51 }
52
53 std::string JsError::ErrorToString(const char* message, const char* filename, in t line)
54 {
55 std::stringstream error;
56 error << message;
57 error << filename;
58 error << ":";
59 error << line;
60 return error.str();
61 }
OLDNEW
« src/JsEngine.cpp ('K') | « src/JsError.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld