From aa2b763a515af8800622bd6964488b33cbe9bf9e Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Thu, 21 Aug 2025 09:56:18 +0200 Subject: [PATCH] Backport PR #7710: Handle file rename errors --- packages/application-extension/src/index.ts | 22 +++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/application-extension/src/index.ts b/packages/application-extension/src/index.ts index 6a6c432330..04c72add7d 100644 --- a/packages/application-extension/src/index.ts +++ b/packages/application-extension/src/index.ts @@ -16,6 +16,7 @@ import { ISanitizer, ISplashScreen, IToolbarWidgetRegistry, + showErrorMessage, } from '@jupyterlab/apputils'; import { ConsolePanel } from '@jupyterlab/console'; @@ -658,14 +659,23 @@ const title: JupyterFrontEndPlugin = { return; } - const result = await renameDialog(docManager, current.context); + try { + const result = await renameDialog(docManager, current.context); - // activate the current widget to bring the focus - if (current) { - current.activate(); - } + // activate the current widget to bring the focus + if (current) { + current.activate(); + } - if (result === null) { + if (result === null) { + return; + } + } catch (error) { + showErrorMessage( + trans.__('Rename Error'), + (error as Error).message || + trans.__('An error occurred while renaming the file.') + ); return; }