Skip to content

Commit 7166986

Browse files
committed
src: adapt to v8::Exception API change
Refs: v8/v8@341bce2 PR-URL: #50115 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
1 parent 4782818 commit 7166986

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

src/env-inl.h

+3-8
Original file line numberDiff line numberDiff line change
@@ -775,14 +775,9 @@ inline void Environment::ThrowRangeError(const char* errmsg) {
775775
ThrowError(v8::Exception::RangeError, errmsg);
776776
}
777777

778-
inline void Environment::ThrowError(V8ExceptionConstructorOld fun,
779-
const char* errmsg) {
780-
v8::HandleScope handle_scope(isolate());
781-
isolate()->ThrowException(fun(OneByteString(isolate(), errmsg)));
782-
}
783-
784-
inline void Environment::ThrowError(V8ExceptionConstructorNew fun,
785-
const char* errmsg) {
778+
inline void Environment::ThrowError(
779+
v8::Local<v8::Value> (*fun)(v8::Local<v8::String>, v8::Local<v8::Value>),
780+
const char* errmsg) {
786781
v8::HandleScope handle_scope(isolate());
787782
isolate()->ThrowException(fun(OneByteString(isolate(), errmsg), {}));
788783
}

src/env.h

+3-8
Original file line numberDiff line numberDiff line change
@@ -1029,14 +1029,9 @@ class Environment : public MemoryRetainer {
10291029
};
10301030

10311031
private:
1032-
// V8 has changed the constructor of exceptions, support both APIs before Node
1033-
// updates to V8 12.1.
1034-
using V8ExceptionConstructorOld =
1035-
v8::Local<v8::Value> (*)(v8::Local<v8::String>);
1036-
using V8ExceptionConstructorNew =
1037-
v8::Local<v8::Value> (*)(v8::Local<v8::String>, v8::Local<v8::Value>);
1038-
inline void ThrowError(V8ExceptionConstructorOld fun, const char* errmsg);
1039-
inline void ThrowError(V8ExceptionConstructorNew fun, const char* errmsg);
1032+
inline void ThrowError(v8::Local<v8::Value> (*fun)(v8::Local<v8::String>,
1033+
v8::Local<v8::Value>),
1034+
const char* errmsg);
10401035
void TrackContext(v8::Local<v8::Context> context);
10411036
void UntrackContext(v8::Local<v8::Context> context);
10421037

0 commit comments

Comments
 (0)