From 6d88f857d0e2287c1d7eeb0e3088b5269bb8c93f Mon Sep 17 00:00:00 2001 From: hst-m <65402951+hst-m@users.noreply.github.com> Date: Mon, 7 Jun 2021 15:49:39 -0700 Subject: [PATCH] fix #540 (#542) --- src/AppWrapper.h | 2 +- src/HttpRequestWrapper.h | 2 +- src/HttpResponseWrapper.h | 2 +- src/Utilities.h | 6 +++--- src/WebSocketWrapper.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/AppWrapper.h b/src/AppWrapper.h index a879fbe..2c92e77 100644 --- a/src/AppWrapper.h +++ b/src/AppWrapper.h @@ -524,7 +524,7 @@ void uWS_App(const FunctionCallbackInfo &args) { /* Throw if we failed to construct the app */ if (app->constructorFailed()) { delete app; - args.GetReturnValue().Set(isolate->ThrowException(String::NewFromUtf8(isolate, "App construction failed", NewStringType::kNormal).ToLocalChecked())); + args.GetReturnValue().Set(isolate->ThrowException(v8::Exception::Error(String::NewFromUtf8(isolate, "App construction failed", NewStringType::kNormal).ToLocalChecked()))); return; } diff --git a/src/HttpRequestWrapper.h b/src/HttpRequestWrapper.h index 969f5e8..6daaed8 100644 --- a/src/HttpRequestWrapper.h +++ b/src/HttpRequestWrapper.h @@ -30,7 +30,7 @@ struct HttpRequestWrapper { /* Thow on deleted request */ auto *req = (uWS::HttpRequest *) args.Holder()->GetAlignedPointerFromInternalField(0); if (!req) { - args.GetReturnValue().Set(isolate->ThrowException(String::NewFromUtf8(isolate, "Using uWS.HttpRequest past its request handler return is forbidden (it is stack allocated).", NewStringType::kNormal).ToLocalChecked())); + args.GetReturnValue().Set(isolate->ThrowException(v8::Exception::Error(String::NewFromUtf8(isolate, "Using uWS.HttpRequest past its request handler return is forbidden (it is stack allocated).", NewStringType::kNormal).ToLocalChecked()))); } return req; } diff --git a/src/HttpResponseWrapper.h b/src/HttpResponseWrapper.h index 440bbd9..8090b5c 100644 --- a/src/HttpResponseWrapper.h +++ b/src/HttpResponseWrapper.h @@ -28,7 +28,7 @@ struct HttpResponseWrapper { Isolate *isolate = args.GetIsolate(); auto *res = (uWS::HttpResponse *) args.Holder()->GetAlignedPointerFromInternalField(0); if (!res) { - args.GetReturnValue().Set(isolate->ThrowException(String::NewFromUtf8(isolate, "Invalid access of discarded (invalid, deleted) uWS.HttpResponse/SSLHttpResponse.", NewStringType::kNormal).ToLocalChecked())); + args.GetReturnValue().Set(isolate->ThrowException(v8::Exception::Error(String::NewFromUtf8(isolate, "Invalid access of discarded (invalid, deleted) uWS.HttpResponse/SSLHttpResponse.", NewStringType::kNormal).ToLocalChecked()))); } return res; } diff --git a/src/Utilities.h b/src/Utilities.h index e3edd78..30af32a 100644 --- a/src/Utilities.h +++ b/src/Utilities.h @@ -55,7 +55,7 @@ static inline bool missingArguments(int length, const FunctionCallbackInfoThrowException(String::NewFromUtf8(args.GetIsolate(), message.c_str(), NewStringType::kNormal).ToLocalChecked())); + args.GetReturnValue().Set(args.GetIsolate()->ThrowException(v8::Exception::Error(String::NewFromUtf8(args.GetIsolate(), message.c_str(), NewStringType::kNormal).ToLocalChecked()))); return true; } return false; @@ -76,7 +76,7 @@ struct Callback { bool isInvalid(const FunctionCallbackInfo &args) { if (invalid) { - args.GetReturnValue().Set(args.GetIsolate()->ThrowException(String::NewFromUtf8(args.GetIsolate(), "Passed callback is not a valid function.", NewStringType::kNormal).ToLocalChecked())); + args.GetReturnValue().Set(args.GetIsolate()->ThrowException(v8::Exception::Error(String::NewFromUtf8(args.GetIsolate(), "Passed callback is not a valid function.", NewStringType::kNormal).ToLocalChecked()))); } return invalid; } @@ -123,7 +123,7 @@ public: bool isInvalid(const FunctionCallbackInfo &args) { if (invalid) { - args.GetReturnValue().Set(args.GetIsolate()->ThrowException(String::NewFromUtf8(args.GetIsolate(), "Text and data can only be passed by String, ArrayBuffer or TypedArray.", NewStringType::kNormal).ToLocalChecked())); + args.GetReturnValue().Set(args.GetIsolate()->ThrowException(v8::Exception::Error(String::NewFromUtf8(args.GetIsolate(), "Text and data can only be passed by String, ArrayBuffer or TypedArray.", NewStringType::kNormal).ToLocalChecked()))); } return invalid; } diff --git a/src/WebSocketWrapper.h b/src/WebSocketWrapper.h index 3f8e2ec..954c8c3 100644 --- a/src/WebSocketWrapper.h +++ b/src/WebSocketWrapper.h @@ -30,7 +30,7 @@ struct WebSocketWrapper { Isolate *isolate = args.GetIsolate(); auto *ws = (uWS::WebSocket *) args.Holder()->GetAlignedPointerFromInternalField(0); if (!ws) { - args.GetReturnValue().Set(isolate->ThrowException(String::NewFromUtf8(isolate, "Invalid access of closed uWS.WebSocket/SSLWebSocket.", NewStringType::kNormal).ToLocalChecked())); + args.GetReturnValue().Set(isolate->ThrowException(v8::Exception::Error(String::NewFromUtf8(isolate, "Invalid access of closed uWS.WebSocket/SSLWebSocket.", NewStringType::kNormal).ToLocalChecked()))); } return ws; }