From 64670a3d9c24698f75f1165704620911065c0f48 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Tue, 10 Mar 2026 17:12:31 +0100 Subject: [PATCH 1/2] repl: add customizable error handling Whether or not an exception should be handled when it was thrown in the REPL's context but the REPL is already closed is something that will depend on the details of the specific REPL instance's use case. Adding this option lets the REPL's creator control the details of this behavior. This resolves a TODO recently added in bd3cba5633e8a36. --- doc/api/repl.md | 14 ++++ lib/repl.js | 25 ++++-- test/parallel/test-repl-user-error-handler.js | 84 +++++++++++++++++++ 3 files changed, 116 insertions(+), 7 deletions(-) create mode 100644 test/parallel/test-repl-user-error-handler.js diff --git a/doc/api/repl.md b/doc/api/repl.md index 0ebd5ca4e6f465..2ed7679ecf7245 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -709,6 +709,9 @@ npx codemod@latest @nodejs/repl-builtin-modules