diff --git a/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/api/HuggingFaceHttpClient.kt b/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/api/HuggingFaceHttpClient.kt index b4958a5ffa76..99dd7eb455b9 100644 --- a/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/api/HuggingFaceHttpClient.kt +++ b/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/api/HuggingFaceHttpClient.kt @@ -28,9 +28,8 @@ object HuggingFaceHttpClient { val linkHeader = connection.getHeaderField("Link") connection.disconnect() HfHttpResponseWithHeaders(content, linkHeader) + }.onFailure { + thisLogger().warn("Failed to download: $url", it) } - //}.onFailure { - // thisLogger().warn("Failed to download: $url", it) - //} } } diff --git a/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/service/HuggingFaceImportedLibrariesManager.kt b/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/service/HuggingFaceImportedLibrariesManager.kt index 6566cdeed8f0..786a45f85658 100644 --- a/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/service/HuggingFaceImportedLibrariesManager.kt +++ b/python/huggingFace/src/com/intellij/python/community/impl/huggingFace/service/HuggingFaceImportedLibrariesManager.kt @@ -3,6 +3,7 @@ package com.intellij.python.community.impl.huggingFace.service import com.intellij.openapi.Disposable import com.intellij.openapi.components.Service +import com.intellij.openapi.diagnostic.thisLogger import com.intellij.openapi.editor.EditorFactory import com.intellij.openapi.editor.event.DocumentEvent import com.intellij.openapi.editor.event.DocumentListener @@ -122,9 +123,13 @@ private class HuggingFaceFileChangesListener(private val onThresholdReached: () private var fileChangesCounter = 0 override fun after(events: List) { - if (events.any { it.file?.extension in listOf("py", "ipynb") }) { - fileChangesCounter++ - if (fileChangesCounter >= HuggingFaceLibrariesManagerConfig.CHANGES_NUM_THRESHOLD) onThresholdReached() + try { + if (events.any { it.file?.extension in listOf("py", "ipynb") }) { + fileChangesCounter++ + if (fileChangesCounter >= HuggingFaceLibrariesManagerConfig.CHANGES_NUM_THRESHOLD) onThresholdReached() + } + } catch (e: Exception) { + thisLogger().warn("Exception in HuggingFaceFileChangesListener.after", e) } } }