From 489c82fb3b287ab53433edc5c94b2ab117ae4909 Mon Sep 17 00:00:00 2001 From: Yourz Date: Mon, 15 Dec 2025 22:16:31 +0800 Subject: [PATCH] fix: add error handling for async node.handleClick Wrap node.handleClick() with errorHandling.wrapWithErrorHandlingAsync to prevent unhandled promise rejections --- src/components/common/TreeExplorer.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/common/TreeExplorer.vue b/src/components/common/TreeExplorer.vue index fab58a098..7343f5c69 100644 --- a/src/components/common/TreeExplorer.vue +++ b/src/components/common/TreeExplorer.vue @@ -368,6 +368,7 @@ const fillNodeInfo = (node: TreeExplorerNode): RenderedTreeExplorerNode => { isEditingLabel: node.key === renameEditingNode.value?.key } } +const errorHandling = useErrorHandling() const onNodeContentClick = async ( e: MouseEvent, node: RenderedTreeExplorerNode @@ -376,7 +377,9 @@ const onNodeContentClick = async ( selectionKeys.value = {} } if (node.handleClick) { - await node.handleClick(e) + await errorHandling.wrapWithErrorHandlingAsync(async () => { + await node.handleClick?.(e) + }, node.handleError)() } emit('nodeClick', node, e) } @@ -390,7 +393,6 @@ const extraMenuItems = computed(() => { : [] }) const renameEditingNode = ref(null) -const errorHandling = useErrorHandling() const handleNodeLabelEdit = async ( node: RenderedTreeExplorerNode, newName: string