From 8c06767fdcbd89b322c155920af4c545ff75b0b1 Mon Sep 17 00:00:00 2001 From: Alex Plate Date: Fri, 20 Oct 2023 11:10:55 +0300 Subject: [PATCH] Show error instead of warning in case of exception --- src/main/java/com/maddyhome/idea/vim/newapi/IjVimLogger.kt | 4 ++++ .../com/maddyhome/idea/vim/command/MappingProcessor.kt | 6 ++++-- .../kotlin/com/maddyhome/idea/vim/diagnostic/VimLogger.kt | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/maddyhome/idea/vim/newapi/IjVimLogger.kt b/src/main/java/com/maddyhome/idea/vim/newapi/IjVimLogger.kt index 36f8847916..4e499f636a 100644 --- a/src/main/java/com/maddyhome/idea/vim/newapi/IjVimLogger.kt +++ b/src/main/java/com/maddyhome/idea/vim/newapi/IjVimLogger.kt @@ -32,6 +32,10 @@ internal class IjVimLogger(private val logger: Logger) : VimLogger { logger.error(message) } + override fun error(message: String, e: Throwable) { + logger.error(message, e) + } + override fun info(message: String) { logger.info(message) } diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/command/MappingProcessor.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/command/MappingProcessor.kt index 38df466d91..73125f2583 100644 --- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/command/MappingProcessor.kt +++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/command/MappingProcessor.kt @@ -182,20 +182,22 @@ public object MappingProcessor { } catch (e: Exception) { injector.messages.showStatusBarMessage(editor, e.message) injector.messages.indicateError() - log.warn( + log.error( """ Caught exception during ${mappingInfo.getPresentableString()} ${e.message} """.trimIndent(), + e ) } catch (e: NotImplementedError) { injector.messages.showStatusBarMessage(editor, e.message) injector.messages.indicateError() - log.warn( + log.error( """ Caught exception during ${mappingInfo.getPresentableString()} ${e.message} """.trimIndent(), + e ) } finally { mappingState.stopMapExecution() diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/diagnostic/VimLogger.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/diagnostic/VimLogger.kt index 1388203d71..92dd92ec60 100644 --- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/diagnostic/VimLogger.kt +++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/diagnostic/VimLogger.kt @@ -19,6 +19,7 @@ public interface VimLogger { public fun warn(message: String) public fun error(message: String) + public fun error(message: String, e: Throwable) public fun info(message: String) }