Skip to content

Commit dd035eb

Browse files
committed
refactor(compiler): use consistent error message format across commands
The commit message above follows the Conventional Commits specification, indicating that it is a fix to the compiler package. It describes the change as using a consistent error message format across all commands. This suggests that previously, different commands were using different formats for error messages, which has now been standardized. The message is concise and to the point, providing enough information for developers to understand the nature of the change without going into unnecessary detail.
1 parent 8ce54d0 commit dd035eb

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/DevInsCompiler.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cc.unitmesh.devti.language.compiler
22

33
import cc.unitmesh.devti.agent.model.CustomAgentConfig
44
import cc.unitmesh.devti.custom.compile.VariableTemplateCompiler
5+
import cc.unitmesh.devti.language.compiler.error.DEVINS_ERROR
56
import cc.unitmesh.devti.language.compiler.exec.*
67
import cc.unitmesh.devti.language.completion.dataprovider.BuiltinCommand
78
import cc.unitmesh.devti.language.completion.dataprovider.CustomCommand
@@ -127,7 +128,7 @@ class DevInsCompiler(
127128
}
128129

129130
if (editor == null || element == null) {
130-
output.append("<DevInsError> No context editor found for variable: ${used.text}")
131+
output.append("$DEVINS_ERROR No context editor found for variable: ${used.text}")
131132
result.hasError = true
132133
return
133134
}
@@ -217,7 +218,7 @@ class DevInsCompiler(
217218

218219
val execResult = runBlocking { command.execute() }
219220

220-
val isSucceed = execResult?.contains("<DevInsError>") == false
221+
val isSucceed = execResult?.contains("$DEVINS_ERROR") == false
221222
val result = if (isSucceed) {
222223
val hasReadCodeBlock = commandNode in listOf(
223224
BuiltinCommand.WRITE,

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/exec/FileFuncInsCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import com.intellij.openapi.vfs.VirtualFile
1010
class FileFuncInsCommand(val myProject: Project, val prop: String) : InsCommand {
1111
override suspend fun execute(): String? {
1212
val (functionName, args) = parseRegex(prop)
13-
?: return """<DevInsError>: file-func is not in the format @file-func:<functionName>(<arg1>, <arg2>, ...)
13+
?: return """$DEVINS_ERROR: file-func is not in the format @file-func:<functionName>(<arg1>, <arg2>, ...)
1414
|Example: @file-func:regex(".*\.kt")
1515
""".trimMargin()
1616

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/run/DevInsRunConfigurationProfileState.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ open class DevInsRunConfigurationProfileState(
114114

115115
console.print("\n--------------------\n", ConsoleViewContentType.NORMAL_OUTPUT)
116116

117-
// throw error if contains any <DevInsError>
118117
if (output.contains(DEVINS_ERROR)) {
119118
processHandler.exitWithError()
120119
return DefaultExecutionResult(console, processHandler)

0 commit comments

Comments
 (0)