diff --git a/src/node_errors.h b/src/node_errors.h index 8d70680171b1a8..171e2a2e09011c 100644 --- a/src/node_errors.h +++ b/src/node_errors.h @@ -113,7 +113,7 @@ void OOMErrorHandler(const char* location, const v8::OOMDetails& details); #define V(code, type) \ template \ - inline v8::Local code( \ + inline v8::Local code( \ v8::Isolate* isolate, const char* format, Args&&... args) { \ std::string message = SPrintF(format, std::forward(args)...); \ v8::Local js_code = OneByteString(isolate, #code); \ @@ -209,17 +209,15 @@ ERRORS_WITH_CODE(V) "Accessing Object.prototype.__proto__ has been " \ "disallowed with --disable-proto=throw") -#define V(code, message) \ - inline v8::Local code(v8::Isolate* isolate) { \ - return code(isolate, message); \ - } \ - inline void THROW_ ## code(v8::Isolate* isolate) { \ - isolate->ThrowException(code(isolate, message)); \ - } \ - inline void THROW_ ## code(Environment* env) { \ - THROW_ ## code(env->isolate()); \ - } - PREDEFINED_ERROR_MESSAGES(V) +#define V(code, message) \ + inline v8::Local code(v8::Isolate* isolate) { \ + return code(isolate, message); \ + } \ + inline void THROW_##code(v8::Isolate* isolate) { \ + isolate->ThrowException(code(isolate, message)); \ + } \ + inline void THROW_##code(Environment* env) { THROW_##code(env->isolate()); } +PREDEFINED_ERROR_MESSAGES(V) #undef V // Errors with predefined non-static messages @@ -231,7 +229,7 @@ inline void THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(Environment* env, THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(env, message.str().c_str()); } -inline v8::Local ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) { +inline v8::Local ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) { char message[128]; snprintf(message, sizeof(message), @@ -240,7 +238,7 @@ inline v8::Local ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) { return ERR_BUFFER_TOO_LARGE(isolate, message); } -inline v8::Local ERR_STRING_TOO_LONG(v8::Isolate* isolate) { +inline v8::Local ERR_STRING_TOO_LONG(v8::Isolate* isolate) { char message[128]; snprintf(message, sizeof(message), "Cannot create a string longer than 0x%x characters",