From 86d5ed26e499b89f05b55bdcd481d40e51b2cff2 Mon Sep 17 00:00:00 2001 From: Carl-Robert Linnupuu Date: Thu, 9 Oct 2025 10:17:59 +0100 Subject: [PATCH] fix: improve auto apply error handling --- .../codegpt/toolwindow/chat/editor/ResponseEditorPanel.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/kotlin/ee/carlrobert/codegpt/toolwindow/chat/editor/ResponseEditorPanel.kt b/src/main/kotlin/ee/carlrobert/codegpt/toolwindow/chat/editor/ResponseEditorPanel.kt index d864773d..deaf48b4 100644 --- a/src/main/kotlin/ee/carlrobert/codegpt/toolwindow/chat/editor/ResponseEditorPanel.kt +++ b/src/main/kotlin/ee/carlrobert/codegpt/toolwindow/chat/editor/ResponseEditorPanel.kt @@ -1,6 +1,7 @@ package ee.carlrobert.codegpt.toolwindow.chat.editor import com.intellij.diff.tools.fragmented.UnifiedDiffViewer +import com.intellij.notification.NotificationType import com.intellij.openapi.Disposable import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.runInEdt @@ -40,8 +41,10 @@ import ee.carlrobert.codegpt.toolwindow.chat.editor.state.EditorStateManager import ee.carlrobert.codegpt.toolwindow.chat.parser.ReplaceWaiting import ee.carlrobert.codegpt.toolwindow.chat.parser.SearchReplace import ee.carlrobert.codegpt.toolwindow.chat.parser.Segment +import ee.carlrobert.codegpt.ui.OverlayUtil import ee.carlrobert.codegpt.util.EditorUtil import ee.carlrobert.llm.client.codegpt.request.AutoApplyRequest +import ee.carlrobert.llm.client.codegpt.response.CodeGPTException import java.util.regex.Pattern class ResponseEditorPanel( @@ -149,6 +152,10 @@ class ResponseEditorPanel( } catch (e: Exception) { logger.error("Failed to apply changes", e) ApplicationManager.getApplication().invokeLater { + if (e is CodeGPTException) { + OverlayUtil.showNotification(e.detail, NotificationType.ERROR) + } + if (!project.isDisposed) { headerPanel.handleDone() }