@@ -20,7 +20,7 @@ import com.apollographql.apollo3.exception.ApolloNetworkException
20
20
import com.intellij.openapi.diagnostic.logger
21
21
import com.intellij.openapi.project.Project
22
22
import com.intellij.psi.PsiElement
23
- import kotlinx.coroutines.runBlocking
23
+ import spp.jetbrains.ScopeExtensions.safeRunBlocking
24
24
import spp.jetbrains.command.LiveCommand
25
25
import spp.jetbrains.indicator.LiveIndicator
26
26
import spp.jetbrains.marker.SourceMarker
@@ -58,22 +58,20 @@ class LivePluginServiceImpl(val project: Project) : LivePluginService {
58
58
override fun registerLiveIndicator (indicator : LiveIndicator ) {
59
59
val eventListener = SourceMarkEventListener {
60
60
if ((indicator.listenForAllEvents || indicator.listenForEvents.contains(it.eventCode)) && it.sourceMark is GuideMark ) {
61
- runBlocking {
61
+ safeRunBlocking {
62
62
try {
63
63
indicator.trigger(it.sourceMark as GuideMark , it)
64
64
} catch (e: ApolloNetworkException ) {
65
- log.warn(" Error while triggering indicator $indicator " , e)
65
+ log.warn(" Network error while triggering indicator $indicator " , e)
66
66
SourceStatusService .getInstance(project).update(ConnectionError , e.message)
67
- } catch (e: Exception ) {
68
- log.warn(" Error while triggering indicator $indicator " , e)
69
67
}
70
68
}
71
69
}
72
70
}
73
71
SourceMarker .getInstance(project).addGlobalSourceMarkEventListener(eventListener)
74
72
indicators[indicator] = eventListener
75
73
76
- runBlocking {
74
+ safeRunBlocking {
77
75
indicator.onRegister()
78
76
}
79
77
log.debug(" Registered indicator: $indicator - Current indicators: ${indicators.size} " )
@@ -88,7 +86,7 @@ class LivePluginServiceImpl(val project: Project) : LivePluginService {
88
86
SourceMarker .getInstance(project).removeGlobalSourceMarkEventListener(it.value)
89
87
indicators.remove(it.key)
90
88
91
- runBlocking {
89
+ safeRunBlocking {
92
90
indicator.onUnregister()
93
91
}
94
92
log.debug(" Unregistered indicator: $indicator - Current indicators: ${indicators.size} " )
0 commit comments