Skip to content

Commit 76aafb8

Browse files
committed
fix(parser): add error logging in CodeBlockElement
1 parent 34b7ea1 commit 76aafb8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/parser/CodeBlockElement.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import cc.unitmesh.devti.language.psi.DevInTypes
55
import cc.unitmesh.devti.util.parser.CodeFence
66
import com.intellij.extapi.psi.ASTWrapperPsiElement
77
import com.intellij.lang.ASTNode
8+
import com.intellij.openapi.diagnostic.logger
89
import com.intellij.openapi.util.TextRange
910
import com.intellij.psi.ElementManipulators
1011
import com.intellij.psi.LiteralTextEscaper
@@ -47,8 +48,13 @@ class CodeBlockElement(node: ASTNode) : ASTWrapperPsiElement(node), PsiLanguageI
4748

4849
companion object {
4950
fun obtainFenceContent(element: CodeBlockElement): List<PsiElement>? {
50-
return CachedValuesManager.getCachedValue(element) {
51-
CachedValueProvider.Result.create(getContent(element), element)
51+
return try {
52+
CachedValuesManager.getCachedValue(element) {
53+
CachedValueProvider.Result.create(getContent(element), element)
54+
}
55+
} catch (e: Exception) {
56+
logger<CodeBlockElement>().error("Failed to obtain code block content", e)
57+
null
5258
}
5359
}
5460

0 commit comments

Comments
 (0)