summaryrefslogtreecommitdiff
path: root/src/node_errors.h
Commit message (Collapse)AuthorAgeFilesLines
* src: mark fatal error functions as noreturnChengzhong Wu2023-04-271-3/+3
| | | | | | | | | | | | OnFatalError and OOMErrorHandler will not return control flow to the calling function. node::FatalError is an alias of node::OnFatalError. Replace all the callsites with node::OnFatalError instead. PR-URL: https://github.com/nodejs/node/pull/47695 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
* quic: add more QUIC implementationJames M Snell2023-04-171-0/+2
| | | | | | | | | | | * add TLSContext * quic: add stat collection utilities * add Packet * add NgTcp2CallbackScope/NgHttp3CallbackScope PR-URL: https://github.com/nodejs/node/pull/47494 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
* sea: use JSON configuration and blob content for SEAJoyee Cheung2023-04-091-0/+16
| | | | | PR-URL: https://github.com/nodejs/node/pull/47125 Refs: https://github.com/nodejs/single-executable/discussions/58 Reviewed-By: Darshan Sen <raisinten@gmail.com>
* src,process: add permission modelRafael Gonzaga2023-02-231-0/+2
| | | | | | | | | | Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: https://github.com/nodejs/node/pull/44004 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* src: implement DataQueueJames M Snell2023-02-191-0/+1
| | | | | | | | See documentation in dataqueue/queue.h for details Co-authored-by: flakey5 <73616808+flakey5@users.noreply.github.com> PR-URL: https://github.com/nodejs/node/pull/45258 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* buffer: add buffer.isUtf8 for utf8 validationYagiz Nizipli2022-12-251-0/+1
| | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/45947 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* util: improve text decoder performanceYagiz Nizipli2022-11-111-0/+1
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/45388 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
* src: use new v8::OOMErrorCallback APIMichaël Zasso2022-10-111-1/+1
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/44741 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: consolidate exit codes in the code baseJoyee Cheung2022-10-061-1/+0
| | | | | | | | | | | | | | | | Add an ExitCode enum class and use it throughout the code base instead of hard-coding the exit codes everywhere. At the moment, the exit codes used in many places do not actually conform to what the documentation describes. With the new enums (which are also available to the JS land as constants in an internal binding) we could migrate to a more consistent usage of the codes, and eventually expose the constants to the user land when they are stable enough. PR-URL: https://github.com/nodejs/node/pull/44746 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
* report: print javascript stack on fatal errorlegendecas2022-08-201-0/+1
| | | | | | | | | | | Try to print JavaScript stack on fatal error. OOMError needs to be distinguished from fatal error since no new handle can be created at that time. PR-URL: https://github.com/nodejs/node/pull/44242 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
* src: disambiguate terms used to refer to builtins and addonsJoyee Cheung2022-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The term "native module" dates back to some of the oldest code in the code base. Within the context of Node.js core it usually refers to modules that are native to Node.js (e.g. fs, http), but it can cause confusion for people who don't work on this part of the code base, as "native module" can also refer to native addons - which is even the case in some of the API docs and error messages. This patch tries to make the usage of these terms more consistent. Now within the context of Node.js core: - JavaScript scripts that are built-in to Node.js are now referred to as "built-in(s)". If they are available as modules, they can also be referred to as "built-in module(s)". - Dynamically-linked shared objects that are loaded into the Node.js processes are referred to as "addons". We will try to avoid using the term "native modules" because it could be ambiguous. Changes in this patch: File names: - node_native_module.h -> node_builtins.h, - node_native_module.cc -> node_builtins.cc C++ binding names: - `native_module` -> `builtins` `node::Environment`: - `native_modules_without_cache` -> `builtins_without_cache` - `native_modules_with_cache` -> `builtins_with_cache` - `native_modules_in_snapshot` -> `builtins_in_cache` - `native_module_require` -> `builtin_module_require` `node::EnvSerializeInfo`: - `native_modules` -> `builtins `node::native_module::NativeModuleLoader`: - `native_module` namespace -> `builtins` namespace - `NativeModuleLoader` -> `BuiltinLoader` - `NativeModuleRecordMap` -> `BuiltinSourceMap` - `NativeModuleCacheMap` -> `BuiltinCodeCacheMap` - `ModuleIds` -> `BuiltinIds` - `ModuleCategories` -> `BuiltinCategories` - `LoadBuiltinModuleSource` -> `LoadBuiltinSource` `loader.js`: - `NativeModule` -> `BuiltinModule` (the `NativeModule` name used in `process.moduleLoadList` is kept for compatibility) And other clarifications in the documentation and comments. PR-URL: https://github.com/nodejs/node/pull/44135 Fixes: https://github.com/nodejs/node/issues/44036 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Jan Krems <jan.krems@gmail.com>
* lib,src: add source map support for global evallegendecas2022-07-111-0/+5
| | | | | | | | | | Dynamic sources with FunctionConstructor is not supported yet as V8 prepends lines to the sources which makes the stack line number incorrect. PR-URL: https://github.com/nodejs/node/pull/43428 Refs: https://github.com/nodejs/node/issues/43047 Reviewed-By: Ben Coe <bencoe@gmail.com>
* process: disallow some uses of Object.defineProperty() on process.envHimself652022-04-041-0/+1
| | | | | | | | | | | | Disallow the use of Object.defineProperty() to hide entries in process.env or make them immutable. PR-URL: https://github.com/nodejs/node/pull/28006 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
* src: add option to disable loading native addonsDominic Elm2021-09-101-0/+1
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/39977 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
* crypto: fix `generateKeyPair` with encoding 'jwk'himself652021-07-261-0/+3
| | | | | | | | Fixes: https://github.com/nodejs/node/issues/39205 PR-URL: https://github.com/nodejs/node/pull/39319 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* Revert "worker: remove `ERR_CLOSED_MESSAGE_PORT`"Juan José Arboleda2021-05-061-0/+2
| | | | | | | | | | | | | This reverts commit 73370b45844fd64e9ca8f9270220e425f9ef8ab6. The unit test is preserved to make sure it does not break https://github.com/nodejs/node/issues/26463 again. PR-URL: https://github.com/nodejs/node/pull/38510 Fixes: https://github.com/nodejs/node/issues/38499 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* net: add SocketAddress classJames M Snell2021-04-021-0/+2
| | | | | | | Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/37917 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* src: add error formatting supportGus Caplan2021-03-091-19/+31
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/37598 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
* quic: remove quicJames M Snell2021-01-301-5/+1
| | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/37067 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
* src: move node_binding to modern THROW_ERR*James M Snell2020-10-101-0/+4
| | | | | | | Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/35469 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
* src: move node_contextify to modern THROW_ERR_*James M Snell2020-10-101-0/+2
| | | | | | | Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/35470 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
* crypto: refactoring internals, add WebCryptoJames M Snell2020-10-071-0/+34
| | | | | | | | | | | | | Fixes: https://github.com/nodejs/node/issues/678 Refs: https://github.com/nodejs/node/issues/26854 Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/35093 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
* crypto: move typechecking for timingSafeEqual into C++Anna Henningsen2020-07-031-0/+3
| | | | | | | | | | | | | | This makes the function more robust against V8 inlining. Fixes: https://github.com/nodejs/node/issues/34073 PR-URL: https://github.com/nodejs/node/pull/34141 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com>
* worker: rename error code to be more accurateAnna Henningsen2020-06-241-2/+2
| | | | | | | | | | | | Rename `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` to `ERR_MISSING_TRANSFERABLE_IN_TRANSFER_LIST` in order to be more accurate. PR-URL: https://github.com/nodejs/node/pull/33872 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
* quic: initial QUIC implementationJames M Snell2020-06-161-2/+6
| | | | | | | | | | | | | | | Co-authored-by: Anna Henningsen <anna@addaleax.net> Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com> Co-authored-by: gengjiawen <technicalcute@gmail.com> Co-authored-by: James M Snell <jasnell@gmail.com> Co-authored-by: Lucas Pardue <lucaspardue.24.7@gmail.com> Co-authored-by: Ouyang Yadong <oyydoibh@gmail.com> Co-authored-by: Juan Jos<C3><A9> Arboleda <soyjuanarbol@gmail.com> Co-authored-by: Trivikram Kamat <trivikr.dev@gmail.com> Co-authored-by: Denys Otrishko <shishugi@gmail.com> PR-URL: https://github.com/nodejs/node/pull/32379 Reviewed-By: Anna Henningsen <anna@addaleax.net>
* worker: emit `'messagerror'` events for failed deserializationAnna Henningsen2020-06-141-0/+4
| | | | | | | | | This is much nicer than just treating exceptions as uncaught, and enables reporting of exceptions from the internal C++ deserialization machinery. PR-URL: https://github.com/nodejs/node/pull/33772 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
* worker: allow passing JS wrapper objects via postMessageAnna Henningsen2020-06-141-1/+2
| | | | | | | | | | | | | | | | | | | | Enable JS wrapper objects to be used as transferable or cloneable objects in `postMessage()` calls, by having them extend a C++-backed class. This requires a few internal changes: - This commit adds the possibility for transferred objects to read/write JS values at the end of the serialization/deserialization phases. - This commit adds the possibility for transferred objects to list sub-transferables, e.g. typically the public JS wrapper class would list its C++ handle in there. - This commit adds usage of `BaseObject` in a few more places, because now during deserialization weakly held objects can also be involved, in addition to `MessagePort`s. PR-URL: https://github.com/nodejs/node/pull/33772 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
* src: remove unused `ERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFER`Anna Henningsen2020-06-111-3/+0
| | | | | | | | | | | Removed in 2bdeb88c27b4d8de3a8f6b7a438cf0bcb88fa927. Refs: https://github.com/nodejs/node/pull/30020 PR-URL: https://github.com/nodejs/node/pull/33810 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* wasi: prevent syscalls before startTobias Nießen2020-05-081-0/+2
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/33235 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* src: avoid using elevated v8 namespaces in node_errors.hJames M Snell2020-04-021-8/+4
| | | | | | | Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/32468 Reviewed-By: Anna Henningsen <anna@addaleax.net>
* worker: runtime error on pthread creationHarshitha KP2020-03-301-0/+2
| | | | | | | | | | | | With large number of worker threads pthread fails with hard assertion. Instead of hard assertion throw a runtime error. PR-URL: https://github.com/nodejs/node/pull/32344 Fixes: https://github.com/nodejs/node/issues/32319 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
* lib: add option to disable __proto__Gus Caplan2020-03-181-28/+32
| | | | | | | | | | | | | | | | Adds `--disable-proto` CLI option which can be set to `delete` or `throw`. Fixes #31951 PR-URL: https://github.com/nodejs/node/pull/32279 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
* esm: port loader code to JSAnna Henningsen2020-03-131-5/+0
| | | | | | | | | | | | | There is no reason for this to be in C++. Using JavaScript means that the code is more accessible to more developers, which is important for any Node.js feature. This also simplifies the code significantly in some areas. On the technical side, this potentially also enables making some of the file system operations that are involved asynchronous. PR-URL: https://github.com/nodejs/node/pull/32201 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com>
* src: handle NULL env scenarioHarshitha KP2020-03-091-22/+25
| | | | | | | | Convert hard assertion into a throw with a useful error message in src/module_wrap.cc. PR-URL: https://github.com/nodejs/node/pull/31899 Reviewed-By: Anna Henningsen <anna@addaleax.net>
* module: package "exports" error refinementsGuy Bedford2020-02-181-1/+3
| | | | | PR-URL: https://github.com/nodejs/node/pull/31625 Reviewed-By: Jan Krems <jan.krems@gmail.com>
* src: use custom fprintf alike to write errors to stderrAnna Henningsen2020-01-231-2/+0
| | | | | | | | | | | | | | This allows printing errors that contain nul characters, for example. Fixes: https://github.com/nodejs/node/issues/28761 Fixes: https://github.com/nodejs/node/issues/31218 PR-URL: https://github.com/nodejs/node/pull/31446 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
* crypto: assign and use ERR_CRYPTO_UNKNOWN_CIPHERTobias Nießen2020-01-231-0/+2
| | | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/31437 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* crypto: add DH support to generateKeyPairTobias Nießen2020-01-211-0/+2
| | | | | | | | This allows using the generateKeyPair API for DH instead of the old stateful DH APIs. PR-URL: https://github.com/nodejs/node/pull/31178 Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
* vm: add code cache support for SourceTextModuleGus Caplan2020-01-121-0/+1
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/31278 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* tls: add PSK supportDenys Otrishko2019-12-251-0/+2
| | | | | | | | | | | | | | | | Add the `pskCallback` client/server option, which resolves an identity or identity hint to a pre-shared key. Add the `pskIdentityHint` server option to set the identity hint for the ServerKeyExchange message. Co-authored-by: Chris Osborn <chris.osborn@sitelier.com> Co-authored-by: stephank <gh@stephank.nl> Co-authored-by: Taylor Zane Glaeser <tzglaeser@gmail.com> PR-URL: https://github.com/nodejs/node/pull/23188 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* src: cleanup unused headersAlexandre Ferrando2019-11-281-2/+0
| | | | | | | | | | | | | | | | | Node codebase has evolved a lot in the more than 10 years of its existence. As more features (and code) have been added, changed, removed, it's sometimes hard to keep track of what gets used and what not. This commits attempts to clean some of those potentially left-over headers using suggestions from include-what-you-use Refs: https://github.com/nodejs/node/issues/27531 PR-URL: https://github.com/nodejs/node/pull/30328 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: add buildflag to force context-aware addonsShelley Vohr2019-09-241-0/+3
| | | | | | PR-URL: https://github.com/nodejs/node/pull/29631 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* crypto: don't expose openssl internalsShelley Vohr2019-08-291-0/+2
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/29325 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
* module: exports error as MODULE_NOT_FOUNDGuy Bedford2019-08-011-1/+0
| | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/28905 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
* module: implement "exports" proposal for CommonJSJan Krems2019-07-231-0/+1
| | | | | | | | | Refs: https://github.com/jkrems/proposal-pkg-exports/issues/36 Refs: https://github.com/nodejs/node/pull/28568 PR-URL: https://github.com/nodejs/node/pull/28759 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
* src: refactor uncaught exception handlingJoyee Cheung2019-06-191-17/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | The C++ land `node::FatalException()` is not in fact fatal anymore. It gives the user a chance to handle the uncaught exception globally by listening to the `uncaughtException` event. This patch renames it to `TriggerUncaughtException` in C++ to avoid the confusion. In addition rename the JS land handler to `onGlobalUncaughtException` to reflect its purpose - we have to keep the alias `process._fatalException` and use that for now since it has been monkey-patchable in the user land. This patch also - Adds more comments to the global uncaught exception handling routine - Puts a few other C++ error handling functions into the `errors` namespace - Moves error-handling-related bindings to the `errors` binding. Refs: https://github.com/nodejs/node/commit/2b252acea47af3ebeac3d7e68277f015667264cc PR-URL: https://github.com/nodejs/node/pull/28257 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
* worker: make MessagePort constructor non-callableAnna Henningsen2019-06-121-1/+3
| | | | | | | | | | | | | | Refactor the C++ code for creating `MessagePort`s to skip calling the constructor and instead directly instantiating the `InstanceTemplate`, and always throw an error from the `MessagePort` constructor. This aligns behaviour with the web, and creating single `MessagePort`s does not make sense anyway. PR-URL: https://github.com/nodejs/node/pull/28032 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* worker: use DataCloneError for unknown native objectsAnna Henningsen2019-06-101-2/+0
| | | | | | | | | | | This aligns the behaviour better with the web. PR-URL: https://github.com/nodejs/node/pull/28025 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
* src: remove util-inl.h from header filesSam Roberts2019-05-131-2/+2
| | | | | | | | | | | | Its intended that *-inl.h header files are only included into the src files that call the inline methods. Explicitly include it into the files that need it. PR-URL: https://github.com/nodejs/node/pull/27631 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* src: move OnMessage to node_errors.ccJoyee Cheung2019-04-261-0/+2
| | | | | | | | | | Rename the per-isolate message listener to `PerIsolateMessageListener` and move it to `node_errors.cc` since it's part of the error handling process. It also creates an external reference so it needs to be exposed in `node_errors.h` for a snapshot builder to know. PR-URL: https://github.com/nodejs/node/pull/27304 Reviewed-By: Anna Henningsen <anna@addaleax.net>