src_adapt_to_v8_exception_api_change.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: John Kleinschmidt <[email protected]>
  3. Date: Mon, 2 Oct 2023 10:59:53 -0400
  4. Subject: src: adapt to v8::Exception API change
  5. 4898682: [api] Add Error.cause to V8 API | https://chromium-review.googlesource.com/c/v8/v8/+/4898682
  6. Cherry picked fix from https://github.com/nodejs/node-v8/commit/675f411677c28a10a2f03d4b3ef14c2284c33587
  7. diff --git a/src/env-inl.h b/src/env-inl.h
  8. index 222c78ef0cb9904742fd44f8182278ab1f50cd59..e248a144b905a6c7c166796cddfe8442f8dc7158 100644
  9. --- a/src/env-inl.h
  10. +++ b/src/env-inl.h
  11. @@ -780,10 +780,10 @@ inline void Environment::ThrowRangeError(const char* errmsg) {
  12. }
  13. inline void Environment::ThrowError(
  14. - v8::Local<v8::Value> (*fun)(v8::Local<v8::String>),
  15. + v8::Local<v8::Value> (*fun)(v8::Local<v8::String>, v8::Local<v8::Value>),
  16. const char* errmsg) {
  17. v8::HandleScope handle_scope(isolate());
  18. - isolate()->ThrowException(fun(OneByteString(isolate(), errmsg)));
  19. + isolate()->ThrowException(fun(OneByteString(isolate(), errmsg), {}));
  20. }
  21. inline void Environment::ThrowErrnoException(int errorno,
  22. diff --git a/src/env.h b/src/env.h
  23. index 87df6e1f32e584aa0c6ae21856299fff31d67669..c9a455be8c395a2f231f56e0a54211466362aa1d 100644
  24. --- a/src/env.h
  25. +++ b/src/env.h
  26. @@ -1017,7 +1017,7 @@ class Environment : public MemoryRetainer {
  27. };
  28. private:
  29. - inline void ThrowError(v8::Local<v8::Value> (*fun)(v8::Local<v8::String>),
  30. + inline void ThrowError(v8::Local<v8::Value> (*fun)(v8::Local<v8::String>, v8::Local<v8::Value>),
  31. const char* errmsg);
  32. void TrackContext(v8::Local<v8::Context> context);
  33. void UntrackContext(v8::Local<v8::Context> context);