From aef5630d8b57c540d6ddac1f88302248d67b2034 Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Tue, 23 Dec 2025 21:21:13 +0100 Subject: [PATCH 1/3] doc: document error event on readline InterfaceConstructor Aims to document the error event introduced by cb3020d in v16.0.0. Fixes: https://github.com/nodejs/node/issues/58289 --- doc/api/readline.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/api/readline.md b/doc/api/readline.md index 580872b98242a8..c064f46c32c5a4 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -102,6 +102,19 @@ The listener function is called without passing any arguments. The `InterfaceConstructor` instance is finished once the `'close'` event is emitted. +### Event: `'error'` + + + +The `'error'` event is emitted when an error occurs on the `input` stream associated with the `readline` `Interface`. + +The listener function is called with an Error object passed as the single argument. + +If no `'error'` event handler is attached to the `InterfaceConstructor` instance, +errors will be thrown as unhandled error events, which may crash the process. + ### Event: `'line'` -The `'error'` event is emitted when an error occurs on the `input` stream associated with the `readline` `Interface`. +The `'error'` event is emitted when an error occurs on the `input` stream +associated with the `node:readline` `Interface`. The listener function is called with an `Error` object passed as the single argument.