From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Kleinschmidt <jkleinsc@electronjs.org>
Date: Mon, 2 Oct 2023 10:59:53 -0400
Subject: src: adapt to v8::Exception API change

4898682: [api] Add Error.cause to V8 API | https://chromium-review.googlesource.com/c/v8/v8/+/4898682
Cherry picked fix from https://github.com/nodejs/node-v8/commit/675f411677c28a10a2f03d4b3ef14c2284c33587

diff --git a/src/env-inl.h b/src/env-inl.h
index 222c78ef0cb9904742fd44f8182278ab1f50cd59..e248a144b905a6c7c166796cddfe8442f8dc7158 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -780,10 +780,10 @@ inline void Environment::ThrowRangeError(const char* errmsg) {
 }
 
 inline void Environment::ThrowError(
-    v8::Local<v8::Value> (*fun)(v8::Local<v8::String>),
+    v8::Local<v8::Value> (*fun)(v8::Local<v8::String>, v8::Local<v8::Value>),
     const char* errmsg) {
   v8::HandleScope handle_scope(isolate());
-  isolate()->ThrowException(fun(OneByteString(isolate(), errmsg)));
+  isolate()->ThrowException(fun(OneByteString(isolate(), errmsg), {}));
 }
 
 inline void Environment::ThrowErrnoException(int errorno,
diff --git a/src/env.h b/src/env.h
index 87df6e1f32e584aa0c6ae21856299fff31d67669..c9a455be8c395a2f231f56e0a54211466362aa1d 100644
--- a/src/env.h
+++ b/src/env.h
@@ -1017,7 +1017,7 @@ class Environment : public MemoryRetainer {
   };
 
  private:
-  inline void ThrowError(v8::Local<v8::Value> (*fun)(v8::Local<v8::String>),
+  inline void ThrowError(v8::Local<v8::Value> (*fun)(v8::Local<v8::String>, v8::Local<v8::Value>),
                          const char* errmsg);
   void TrackContext(v8::Local<v8::Context> context);
   void UntrackContext(v8::Local<v8::Context> context);
