From 428ebde5aaa3d17deb801a5e52bd161fd7cb0139 Mon Sep 17 00:00:00 2001 From: Richard Li <742829+rli@users.noreply.github.com> Date: Wed, 12 Feb 2025 08:19:24 -0800 Subject: [PATCH] fix(q): include exception context when logging encoder failure Logs indicate failure but no further details --- .../amazonq/project/ProjectContextController.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/ProjectContextController.kt b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/ProjectContextController.kt index dabe282f2fd..2a21d60c0d9 100644 --- a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/ProjectContextController.kt +++ b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/ProjectContextController.kt @@ -55,7 +55,7 @@ class ProjectContextController(private val project: Project, private val cs: Cor try { return projectContextProvider.query(prompt, timeout) } catch (e: Exception) { - logger.warn { "error while querying for project context $e.message" } + logger.warn(e) { "error while querying for project context" } return emptyList() } } @@ -64,11 +64,11 @@ class ProjectContextController(private val project: Project, private val cs: Cor try { projectContextProvider.queryInline(query, filePath, InlineContextTarget.CODEMAP) } catch (e: Exception) { - var logStr = "error while querying inline for project context $e.message" if (e is TimeoutCancellationException || e is TimeoutException) { - logStr = "project context times out with 50ms ${e.message}" + logger.warn { "project context times out with 50ms" } + } else { + logger.warn(e) { "error while querying inline for project context" } } - logger.warn { logStr } emptyList() } @@ -77,7 +77,7 @@ class ProjectContextController(private val project: Project, private val cs: Cor try { return projectContextProvider.updateIndex(filePaths, mode) } catch (e: Exception) { - logger.warn { "error while updating index for project context $e.message" } + logger.warn(e) { "error while updating index for project context" } } }