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

Delta Between Two Patch Sets: src/Utils.cpp

Issue 29810586: Issue 6526 - Use the maybe version of Compile() and Run() (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Left Patch Set: Don't have a different error type. Created June 19, 2018, 5:40 p.m.
Right Patch Set: r-value CheckedToLocal Created June 21, 2018, 1:04 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/Utils.h ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include <stdexcept> 18 #include <stdexcept>
19 19
20 #ifdef _WIN32 20 #ifdef _WIN32
21 #include <Windows.h> 21 #include <Windows.h>
22 #include <Shlwapi.h> 22 #include <Shlwapi.h>
23 #endif 23 #endif
24 24
25 #include "Utils.h" 25 #include "Utils.h"
26 26
27 using namespace AdblockPlus; 27 using namespace AdblockPlus;
28
29 void Utils::CheckTryCatch(v8::Isolate* isolate, const v8::TryCatch& tryCatch)
30 {
31 if (tryCatch.HasCaught())
32 throw AdblockPlus::JsError(isolate, tryCatch.Exception(), tryCatch.Message() );
33 }
28 34
29 std::string Utils::FromV8String(v8::Isolate* isolate, const v8::Local<v8::Value> & value) 35 std::string Utils::FromV8String(v8::Isolate* isolate, const v8::Local<v8::Value> & value)
30 { 36 {
31 v8::String::Utf8Value stringValue(isolate, value); 37 v8::String::Utf8Value stringValue(isolate, value);
32 if (stringValue.length()) 38 if (stringValue.length())
33 return std::string(*stringValue, stringValue.length()); 39 return std::string(*stringValue, stringValue.length());
34 else 40 else
35 return std::string(); 41 return std::string();
36 } 42 }
37 43
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 if (FAILED(hr)) 115 if (FAILED(hr))
110 { 116 {
111 throw std::runtime_error("CanonizeUrl failed\n"); 117 throw std::runtime_error("CanonizeUrl failed\n");
112 } 118 }
113 } 119 }
114 return canonizedUrl; 120 return canonizedUrl;
115 121
116 } 122 }
117 #endif 123 #endif
118 124
LEFTRIGHT
« src/Utils.h ('k') | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld