@@ -106,7 +106,7 @@ void OOMErrorHandler(const char* location, const v8::OOMDetails& details); |
106 | 106 |
|
107 | 107 | #define V(code, type) \ |
108 | 108 | template <typename... Args> \ |
109 | | - inline v8::Local<v8::Value> code( \ |
| 109 | + inline v8::Local<v8::Object> code( \ |
110 | 110 | v8::Isolate* isolate, const char* format, Args&&... args) { \ |
111 | 111 | std::string message = SPrintF(format, std::forward<Args>(args)...); \ |
112 | 112 | v8::Local<v8::String> js_code = OneByteString(isolate, #code); \ |
@@ -206,17 +206,15 @@ ERRORS_WITH_CODE(V) |
206 | 206 | "Accessing Object.prototype.__proto__ has been " \ |
207 | 207 | "disallowed with --disable-proto=throw") |
208 | 208 |
|
209 | | -#define V(code, message) \ |
210 | | - inline v8::Local<v8::Value> code(v8::Isolate* isolate) { \ |
211 | | - return code(isolate, message); \ |
212 | | - } \ |
213 | | - inline void THROW_ ## code(v8::Isolate* isolate) { \ |
214 | | - isolate->ThrowException(code(isolate, message)); \ |
215 | | - } \ |
216 | | - inline void THROW_ ## code(Environment* env) { \ |
217 | | - THROW_ ## code(env->isolate()); \ |
218 | | - } |
219 | | - PREDEFINED_ERROR_MESSAGES(V) |
| 209 | +#define V(code, message) \ |
| 210 | + inline v8::Local<v8::Object> code(v8::Isolate* isolate) { \ |
| 211 | + return code(isolate, message); \ |
| 212 | + } \ |
| 213 | + inline void THROW_##code(v8::Isolate* isolate) { \ |
| 214 | + isolate->ThrowException(code(isolate, message)); \ |
| 215 | + } \ |
| 216 | + inline void THROW_##code(Environment* env) { THROW_##code(env->isolate()); } |
| 217 | +PREDEFINED_ERROR_MESSAGES(V) |
220 | 218 | #undef V |
221 | 219 |
|
222 | 220 | // Errors with predefined non-static messages |
@@ -228,15 +226,15 @@ inline void THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(Environment* env, |
228 | 226 | THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(env, message.str().c_str()); |
229 | 227 | } |
230 | 228 |
|
231 | | -inline v8::Local<v8::Value> ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) { |
| 229 | +inline v8::Local<v8::Object> ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) { |
232 | 230 | char message[128]; |
233 | 231 | snprintf(message, sizeof(message), |
234 | 232 | "Cannot create a Buffer larger than 0x%zx bytes", |
235 | 233 | v8::TypedArray::kMaxLength); |
236 | 234 | return ERR_BUFFER_TOO_LARGE(isolate, message); |
237 | 235 | } |
238 | 236 |
|
239 | | -inline v8::Local<v8::Value> ERR_STRING_TOO_LONG(v8::Isolate* isolate) { |
| 237 | +inline v8::Local<v8::Object> ERR_STRING_TOO_LONG(v8::Isolate* isolate) { |
240 | 238 | char message[128]; |
241 | 239 | snprintf(message, sizeof(message), |
242 | 240 | "Cannot create a string longer than 0x%x characters", |
|