IDEA-345136 Improve error handling

GitOrigin-RevId: 644d1ad6be0cc60ef87dcc3cb0f262518761c157
This commit is contained in:
Vera Petrenkova
2024-03-20 11:00:57 +00:00
committed by intellij-monorepo-bot
parent 5d73e6ebe9
commit 299afb0617
2 changed files with 4 additions and 2 deletions
@@ -101,8 +101,9 @@ class DefaultTemplate(val name: String,
if (text == null) {
logger<DefaultTemplate>().error("Cannot find file by path: $fullPath")
return "Unexpected error occurred"
}
return text ?: ""
return text
}
// the only external usage - https://github.com/wrdv/testme-idea/blob/8e314aea969619f43f0c6bb17f53f1d95b1072be/src/main/java/com/weirddev/testme/intellij/ui/template/FTManager.java#L200
@@ -342,8 +342,9 @@ private fun getLocalizedContent(path: String, pathResolver: Function<String, Str
val result = pathResolver.apply(fullPath.invariantSeparatorsPathString)
if (result == null) {
logger<FileTemplatesLoader>().error("Cannot find file by path: $path")
return "Unexpected error occurred"
}
return result ?: ""
return result
}
private fun loadFileContent(root: Path, filePath: String): String? {