diff --git a/doc/api/errors.md b/doc/api/errors.md index 8ed4b31f99aa68..6ba0e36ab74ea9 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -1561,6 +1561,17 @@ behavior. See the documentation for [policy][] manifests for more information. An attempt was made to allocate memory (usually in the C++ layer) but it failed. + +### `ERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLE` + + +A message posted to a [`MessagePort`][] could not be deserialized in the target +[vm][] `Context`. Not all Node.js objects can be successfully instantiated in +any context at this time, and attempting to transfer them using `postMessage()` +can fail on the receiving side in that case. + ### `ERR_METHOD_NOT_IMPLEMENTED` @@ -2557,6 +2568,7 @@ such as `process.stdout.on('data')`. [`Class: assert.AssertionError`]: assert.html#assert_class_assert_assertionerror [`ERR_INVALID_ARG_TYPE`]: #ERR_INVALID_ARG_TYPE [`EventEmitter`]: events.html#events_class_eventemitter +[`MessagePort`]: worker_threads.html#worker_threads_class_messageport [`Object.getPrototypeOf`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf [`Object.setPrototypeOf`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf [`REPL`]: repl.html diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 6dfba7a78382a1..250e8f850a03d4 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -303,6 +303,15 @@ input of [`port.postMessage()`][]. Listeners on this event will receive a clone of the `value` parameter as passed to `postMessage()` and no further arguments. +### Event: `'messageerror'` + + +* `error` {Error} An Error object + +The `'messageerror'` event is emitted when deserializing a message failed. + ### `port.close()` + +* `error` {Error} An Error object + +The `'messageerror'` event is emitted when deserializing a message failed. + ### Event: `'online'`