From 9aaab20d1a9478aa46f88e0c36790fec3fc6b313 Mon Sep 17 00:00:00 2001 From: TrivCodez Date: Sun, 5 Jul 2026 13:55:41 +1000 Subject: [PATCH] chore: fix ESLint crash in @stdlib/fs/rename/lib/index.js The `stdlib/jsdoc-doctest` ESLint rule executes @example code in a VM. The async rename example calls `rename('./beep/boop.txt', './beep/foo.txt', done)` with a callback that throws the error. Since fs.rename is async, the callback fires after the VM context is gone, causing an unhandled Node.js exception that kills the ESLint process. Fix: change the error handling in examples from `throw` to `console.error(message)`, matching the pattern used by @stdlib/fs/unlink. resolves #13273 --- lib/node_modules/@stdlib/fs/rename/lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/fs/rename/lib/index.js b/lib/node_modules/@stdlib/fs/rename/lib/index.js index 9c67b5f2f1ea..c5d8f6311f17 100644 --- a/lib/node_modules/@stdlib/fs/rename/lib/index.js +++ b/lib/node_modules/@stdlib/fs/rename/lib/index.js @@ -28,7 +28,7 @@ * * function done( error ) { * if ( error ) { -* throw error; +* console.error( error.message ); * } * } * @@ -39,7 +39,7 @@ * * var err = renameSync( './beep/boop.txt', './beep/foo.txt' ); * if ( err instanceof Error ) { -* throw err; +* console.error( err.message ); * } */