| 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 25 matching lines...) Expand all Loading... |
| 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 } |
| OLD | NEW |