Skip to content

Commit 45f21b2

Browse files
committed
fix(test): add error notification when test file creation fails
When the test file creation fails, an error notification is now added using the AutoDevStatusService. This helps to identify and handle the failure more effectively.
1 parent 654d4a3 commit 45f21b2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/kotlin/cc/unitmesh/devti/intentions/action/task/TestCodeGenTask.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ class TestCodeGenTask(val request: TestCodeGenRequest) :
6161

6262
if (testContext == null) {
6363
if (writeTestService == null) {
64+
AutoDevStatusService.notifyApplication(AutoDevStatus.Error)
6465
logger.error("Could not find WriteTestService for: ${request.file}")
6566
return
6667
}
6768

69+
AutoDevStatusService.notifyApplication(AutoDevStatus.Error)
6870
logger.error("Failed to create test file for: ${request.file}")
6971
return
7072
}
@@ -98,7 +100,7 @@ class TestCodeGenTask(val request: TestCodeGenRequest) :
98100
testPromptContext.imports = testContext.imports.joinToString("\n") {
99101
"$comment $it"
100102
}
101-
// prompter += "\nCode:\n$importString\n```${lang.lowercase()}\n${request.selectText}\n```\n"
103+
102104
testPromptContext.sourceCode = request.selectText
103105
testPromptContext.isNewFile = testContext.isNewFile
104106

0 commit comments

Comments
 (0)