From ac2f204d834fb127bcbae38c7b4e8a5842287b19 Mon Sep 17 00:00:00 2001 From: Blarc Date: Sat, 17 Jun 2023 15:34:51 +0200 Subject: [PATCH] fix(action): set error as commit message (#51) --- CHANGELOG.md | 2 ++ gradle.properties | 2 +- .../github/blarc/ai/commits/intellij/plugin/AICommitAction.kt | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de1a7e6..616d064 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [Unreleased] +### Fixed +- Set error message as commit message when OpenAI API returns error, because notification seems unreliable. ## [1.2.0] - 2023-06-15 diff --git a/gradle.properties b/gradle.properties index c6a7125..c3a51b5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ pluginGroup = com.github.blarc pluginName = AICommits pluginRepositoryUrl = https://github.com/Blarc/ai-commits-intellij-plugin # SemVer format -> https://semver.org -pluginVersion = 1.2.0 +pluginVersion = 1.2.1 # https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 231 diff --git a/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/AICommitAction.kt b/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/AICommitAction.kt index 258ad0b..029dbdb 100644 --- a/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/AICommitAction.kt +++ b/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/AICommitAction.kt @@ -66,7 +66,7 @@ class AICommitAction : AnAction(), DumbAware { commitMessage.setCommitMessage(generatedCommitMessage) AppSettings.instance.recordHit() } catch (e: Exception) { - commitMessage.setCommitMessage(message("action.error")) + commitMessage.setCommitMessage(e.message ?: message("action.error")) sendNotification(Notification.unsuccessfulRequest(e.message ?: message("action.unknown-error"))) } }