OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 error << *v8::String::Utf8Value(isolate, message->GetScriptResourceName()); | 37 error << *v8::String::Utf8Value(isolate, message->GetScriptResourceName()); |
38 error << ":"; | 38 error << ":"; |
39 auto lineNumber = message->GetLineNumber(isolate->GetCurrentContext()); | 39 auto lineNumber = message->GetLineNumber(isolate->GetCurrentContext()); |
40 if (lineNumber.IsJust()) | 40 if (lineNumber.IsJust()) |
41 error << lineNumber.FromJust(); | 41 error << lineNumber.FromJust(); |
42 else | 42 else |
43 error << "<unknown>"; | 43 error << "<unknown>"; |
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 } |
OLD | NEW |