|
@@ -1,56 +0,0 @@
|
|
|
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
-From: Shelley Vohr <[email protected]>
|
|
|
-Date: Thu, 3 Jun 2021 19:32:09 +0200
|
|
|
-Subject: src: add get/set pair for unhandled rejections mode
|
|
|
-
|
|
|
-This PR adds a get/set pair for unhandled rejections modes.
|
|
|
-
|
|
|
-We do not want unhandled rejections to crash the process and want to
|
|
|
-be able to control this effectively from C++ and not cli flag
|
|
|
-which is the only option right now.
|
|
|
-
|
|
|
-Upstreamed at https://github.com/nodejs/node/pull/38915.
|
|
|
-
|
|
|
-diff --git a/src/env-inl.h b/src/env-inl.h
|
|
|
-index dc37298aa0e13bb79030123f38070d0254691b28..6b9c340fee164c09ec51037121efc91ec0ab4a8b 100644
|
|
|
---- a/src/env-inl.h
|
|
|
-+++ b/src/env-inl.h
|
|
|
-@@ -570,6 +570,24 @@ inline bool Environment::abort_on_uncaught_exception() const {
|
|
|
- return options_->abort_on_uncaught_exception;
|
|
|
- }
|
|
|
-
|
|
|
-+inline void Environment::set_unhandled_rejections_mode(
|
|
|
-+ const std::string& mode) {
|
|
|
-+ if (!mode.empty() &&
|
|
|
-+ mode != "warn-with-error-code" &&
|
|
|
-+ mode != "throw" &&
|
|
|
-+ mode != "strict" &&
|
|
|
-+ mode != "warn" &&
|
|
|
-+ mode != "none") {
|
|
|
-+ fprintf(stderr, "Invalid unhandled rejections mode: %s\n", mode.c_str());
|
|
|
-+ } else {
|
|
|
-+ options_->unhandled_rejections = mode;
|
|
|
-+ }
|
|
|
-+}
|
|
|
-+
|
|
|
-+inline std::string Environment::unhandled_rejections_mode() const {
|
|
|
-+ return options_->unhandled_rejections;
|
|
|
-+}
|
|
|
-+
|
|
|
- inline void Environment::set_force_context_aware(bool value) {
|
|
|
- options_->force_context_aware = value;
|
|
|
- }
|
|
|
-diff --git a/src/env.h b/src/env.h
|
|
|
-index eaf8a17c99aa6a4135c54616f68b15e0620e4378..dcc163be2c2fa632660dde78012440fe50b03aa3 100644
|
|
|
---- a/src/env.h
|
|
|
-+++ b/src/env.h
|
|
|
-@@ -1121,6 +1121,9 @@ class Environment : public MemoryRetainer {
|
|
|
- void PrintSyncTrace() const;
|
|
|
- inline void set_trace_sync_io(bool value);
|
|
|
-
|
|
|
-+ inline void set_unhandled_rejections_mode(const std::string& mode);
|
|
|
-+ inline std::string unhandled_rejections_mode() const;
|
|
|
-+
|
|
|
- inline void set_force_context_aware(bool value);
|
|
|
- inline bool force_context_aware() const;
|
|
|
-
|