diff --git a/src/main/kotlin/io/snyk/plugin/SnykPostStartupActivity.kt b/src/main/kotlin/io/snyk/plugin/SnykPostStartupActivity.kt index c73b25dc8..7f136add0 100644 --- a/src/main/kotlin/io/snyk/plugin/SnykPostStartupActivity.kt +++ b/src/main/kotlin/io/snyk/plugin/SnykPostStartupActivity.kt @@ -66,8 +66,12 @@ class SnykPostStartupActivity : ProjectActivity { if (!ApplicationManager.getApplication().isUnitTestMode) { getSnykTaskQueueService(project)?.downloadLatestRelease() - getSnykTaskQueueService(project)?.initializeLanguageServer() - getAnalyticsScanListener(project)?.initScanListener() + try { + getSnykTaskQueueService(project)?.initializeLanguageServer() + getAnalyticsScanListener(project)?.initScanListener() + } catch (ignored: Exception) { + // do nothing to not break UX for analytics + } } val feedbackRequestShownMoreThenTwoWeeksAgo = diff --git a/src/main/kotlin/snyk/common/lsp/LanguageServerWrapper.kt b/src/main/kotlin/snyk/common/lsp/LanguageServerWrapper.kt index 213f3b499..fe2b61f06 100644 --- a/src/main/kotlin/snyk/common/lsp/LanguageServerWrapper.kt +++ b/src/main/kotlin/snyk/common/lsp/LanguageServerWrapper.kt @@ -70,11 +70,15 @@ class LanguageServerWrapper(private val lsPath: String = getCliFile().absolutePa } fun sendReportAnalyticsCommand(scanDoneEvent: ScanDoneEvent) { - val eventString = gson.toJson(scanDoneEvent) - val param = ExecuteCommandParams() - param.command = "snyk.reportAnalytics" - param.arguments = listOf(eventString) - languageServer.workspaceService.executeCommand(param) + try { + val eventString = gson.toJson(scanDoneEvent) + val param = ExecuteCommandParams() + param.command = "snyk.reportAnalytics" + param.arguments = listOf(eventString) + languageServer.workspaceService.executeCommand(param) + } catch (ignored: Exception) { + // do nothing to not break UX for analytics + } } fun getInitializationOptions(): LanguageServerSettings {