This commit is contained in:
hst-m 2021-06-07 15:49:39 -07:00 committed by GitHub
parent 9af80e10ce
commit 6d88f857d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View File

@ -524,7 +524,7 @@ void uWS_App(const FunctionCallbackInfo<Value> &args) {
/* Throw if we failed to construct the app */ /* Throw if we failed to construct the app */
if (app->constructorFailed()) { if (app->constructorFailed()) {
delete app; 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; return;
} }

View File

@ -30,7 +30,7 @@ struct HttpRequestWrapper {
/* Thow on deleted request */ /* Thow on deleted request */
auto *req = (uWS::HttpRequest *) args.Holder()->GetAlignedPointerFromInternalField(0); auto *req = (uWS::HttpRequest *) args.Holder()->GetAlignedPointerFromInternalField(0);
if (!req) { 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; return req;
} }

View File

@ -28,7 +28,7 @@ struct HttpResponseWrapper {
Isolate *isolate = args.GetIsolate(); Isolate *isolate = args.GetIsolate();
auto *res = (uWS::HttpResponse<SSL> *) args.Holder()->GetAlignedPointerFromInternalField(0); auto *res = (uWS::HttpResponse<SSL> *) args.Holder()->GetAlignedPointerFromInternalField(0);
if (!res) { 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; return res;
} }

View File

@ -55,7 +55,7 @@ static inline bool missingArguments(int length, const FunctionCallbackInfo<Value
std::string message = "Function requires at least "; std::string message = "Function requires at least ";
message += std::to_string(length); message += std::to_string(length);
message += " arguments."; message += " arguments.";
args.GetReturnValue().Set(args.GetIsolate()->ThrowException(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 true;
} }
return false; return false;
@ -76,7 +76,7 @@ struct Callback {
bool isInvalid(const FunctionCallbackInfo<Value> &args) { bool isInvalid(const FunctionCallbackInfo<Value> &args) {
if (invalid) { 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; return invalid;
} }
@ -123,7 +123,7 @@ public:
bool isInvalid(const FunctionCallbackInfo<Value> &args) { bool isInvalid(const FunctionCallbackInfo<Value> &args) {
if (invalid) { 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; return invalid;
} }

View File

@ -30,7 +30,7 @@ struct WebSocketWrapper {
Isolate *isolate = args.GetIsolate(); Isolate *isolate = args.GetIsolate();
auto *ws = (uWS::WebSocket<SSL, true, PerSocketData> *) args.Holder()->GetAlignedPointerFromInternalField(0); auto *ws = (uWS::WebSocket<SSL, true, PerSocketData> *) args.Holder()->GetAlignedPointerFromInternalField(0);
if (!ws) { 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; return ws;
} }