Skip to content

Commit

Permalink
[env] Remove lambda argument in Throw constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
victorgomes committed Jun 3, 2024
1 parent fc5de5f commit a6c1dbd
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -782,20 +782,25 @@ inline void Environment::ForEachRealm(T&& iterator) const {
}

inline void Environment::ThrowError(const char* errmsg) {
ThrowError(v8::Exception::Error, errmsg);
v8::HandleScope handle_scope(isolate());
isolate()->ThrowException(
v8::Exception::Error(OneByteString(isolate(), errmsg)));
}

inline void Environment::ThrowTypeError(const char* errmsg) {
ThrowError(v8::Exception::TypeError, errmsg);
v8::HandleScope handle_scope(isolate());
isolate()->ThrowException(
v8::Exception::TypeError(OneByteString(isolate(), errmsg)));
}

inline void Environment::ThrowRangeError(const char* errmsg) {
ThrowError(v8::Exception::RangeError, errmsg);
v8::HandleScope handle_scope(isolate());
isolate()->ThrowException(
v8::Exception::RangeError(OneByteString(isolate(), errmsg)));
}

inline void Environment::ThrowError(
v8::Local<v8::Value> (*fun)(v8::Local<v8::String>, v8::Local<v8::Value>),
const char* errmsg) {
inline void Environment::ThrowError(V8ExceptionConstructorNew fun,
const char* errmsg) {
v8::HandleScope handle_scope(isolate());
isolate()->ThrowException(fun(OneByteString(isolate(), errmsg), {}));
}
Expand Down

0 comments on commit a6c1dbd

Please sign in to comment.