Skip to content

Commit caf3b7b

Browse files
对于复制/替换本地化的意向,补上必要的错误日志(警告级别)
1 parent 3d4fe26 commit caf3b7b

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

src/main/kotlin/icu/windea/pls/lang/intentions/localisation/CopyLocalisationFromLocaleIntention.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package icu.windea.pls.lang.intentions.localisation
22

33
import com.intellij.notification.*
44
import com.intellij.openapi.application.*
5+
import com.intellij.openapi.diagnostic.thisLogger
56
import com.intellij.openapi.ide.*
67
import com.intellij.openapi.project.*
78
import com.intellij.platform.ide.progress.*
@@ -71,6 +72,8 @@ class CopyLocalisationFromLocaleIntention : CopyLocalisationIntentionBase() {
7172
}
7273

7374
private fun createFailedNotification(project: Project, selectedLocale: CwtLocaleConfig, error: Throwable) {
75+
thisLogger().warn(error)
76+
7477
val errorDetails = error.message?.let { "<br>$it" }.orEmpty()
7578
val content = PlsBundle.message("intention.copyLocalisationFromLocale.notification.1", selectedLocale) + errorDetails
7679
createNotification(content, NotificationType.WARNING).notify(project)

src/main/kotlin/icu/windea/pls/lang/intentions/localisation/CopyLocalisationWithTranslationIntention.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package icu.windea.pls.lang.intentions.localisation
22

33
import com.intellij.notification.*
44
import com.intellij.openapi.application.*
5+
import com.intellij.openapi.diagnostic.thisLogger
56
import com.intellij.openapi.editor.*
67
import com.intellij.openapi.ide.*
78
import com.intellij.openapi.project.*
@@ -84,6 +85,8 @@ class CopyLocalisationWithTranslationIntention : CopyLocalisationIntentionBase()
8485
}
8586

8687
private fun createFailedNotification(project: Project, selectedLocale: CwtLocaleConfig, error: Throwable) {
88+
thisLogger().warn(error)
89+
8790
val errorDetails = error.message?.let { "<br>$it" }.orEmpty()
8891
val content = PlsBundle.message("intention.copyLocalisationWithTranslation.notification.1", selectedLocale) + errorDetails
8992
createNotification(content, NotificationType.WARNING).notify(project)

src/main/kotlin/icu/windea/pls/lang/intentions/localisation/ReplaceLocalisationFromLocaleIntention.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package icu.windea.pls.lang.intentions.localisation
33
import com.intellij.notification.*
44
import com.intellij.openapi.application.*
55
import com.intellij.openapi.command.*
6+
import com.intellij.openapi.diagnostic.thisLogger
67
import com.intellij.openapi.project.*
78
import com.intellij.platform.ide.progress.*
89
import com.intellij.platform.util.coroutines.*
@@ -87,6 +88,8 @@ class ReplaceLocalisationFromLocaleIntention : ReplaceLocalisationIntentionBase(
8788
}
8889

8990
private fun createFailedNotification(project: Project, selectedLocale: CwtLocaleConfig, error: Throwable) {
91+
thisLogger().warn(error)
92+
9093
val errorDetails = error.message?.let { "<br>$it" }.orEmpty()
9194
val content = PlsBundle.message("intention.replaceLocalisationFromLocale.notification.1", selectedLocale) + errorDetails
9295
createNotification(content, NotificationType.WARNING).notify(project)

src/main/kotlin/icu/windea/pls/lang/intentions/localisation/ReplaceLocalisationWithTranslationIntention.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package icu.windea.pls.lang.intentions.localisation
33
import com.intellij.notification.*
44
import com.intellij.openapi.application.*
55
import com.intellij.openapi.command.*
6+
import com.intellij.openapi.diagnostic.thisLogger
67
import com.intellij.openapi.project.*
78
import com.intellij.platform.ide.progress.*
89
import com.intellij.platform.util.coroutines.*
@@ -94,6 +95,8 @@ class ReplaceLocalisationWithTranslationIntention : ReplaceLocalisationIntention
9495
}
9596

9697
private fun createFailedNotification(project: Project, selectedLocale: CwtLocaleConfig, error: Throwable) {
98+
thisLogger().warn(error)
99+
97100
val errorDetails = error.message?.let { "<br>$it" }.orEmpty()
98101
val content = PlsBundle.message("intention.replaceLocalisationWithTranslation.notification.1", selectedLocale) + errorDetails
99102
createNotification(content, NotificationType.WARNING).notify(project)

0 commit comments

Comments
 (0)