@@ -93,18 +93,33 @@ class UpdatesService(private val project: Project) : Disposable {
9393
9494 override fun connectionGained () {
9595 Log .log(logger::debug, " got connectionGained" )
96- // update state immediately after connectionGained, so it will not wait the delay for checking the versions.
97- checkForNewerVersions()
96+
97+ try {
98+ // update state immediately after connectionGained, so it will not wait the delay for checking the versions.
99+ checkForNewerVersions()
100+ } catch (e: CancellationException ) {
101+ Log .debugWithException(logger, e, " Exception in checkForNewerVersions" )
102+ } catch (e: Throwable ) {
103+ Log .debugWithException(logger, e, " Exception in checkForNewerVersions {}" , ExceptionUtils .getNonEmptyMessage(e))
104+ ErrorReporter .getInstance().reportError(" UpdatesService.connectionGained" , e)
105+ }
98106 }
99107 })
100108
101109
102110 SettingsState .getInstance().addChangeListener({
103111 @Suppress(" UnstableApiUsage" )
104112 disposingScope().launch {
105- // update state immediately after settings change. we are interested in api url change, but it will
106- // do no harm to call it on any settings change
107- checkForNewerVersions()
113+ try {
114+ // update state immediately after settings change. we are interested in api url change, but it will
115+ // do no harm to call it on any settings change
116+ checkForNewerVersions()
117+ } catch (e: CancellationException ) {
118+ Log .debugWithException(logger, e, " Exception in checkForNewerVersions" )
119+ } catch (e: Throwable ) {
120+ Log .debugWithException(logger, e, " Exception in checkForNewerVersions {}" , ExceptionUtils .getNonEmptyMessage(e))
121+ ErrorReporter .getInstance().reportError(" UpdatesService.settingsChanged" , e)
122+ }
108123 }
109124
110125 }, this )
@@ -114,6 +129,7 @@ class UpdatesService(private val project: Project) : Disposable {
114129 // nothing to do , used as parent disposable
115130 }
116131
132+ // this method may throw exception, always catch and report
117133 private fun checkForNewerVersions () {
118134
119135 Log .log(logger::trace, " checking for new versions" )
0 commit comments