Handle all exceptions are thrown by prediction calculating

GitOrigin-RevId: 9a881a16ccc42446b3ce7c53e93390f36c98a296
This commit is contained in:
Nikolay.Rykunov
2019-07-02 06:52:16 +03:00
committed by intellij-monorepo-bot
parent dcf205bf0d
commit ba4dd580a3
@@ -30,19 +30,21 @@ internal abstract class PredictionController(private val project: Project,
val task: Task.Backgroundable = object : Task.Backgroundable(project, "ChangeReminder Prediction Calculating") {
override fun run(indicator: ProgressIndicator) {
inProgress = true
val result = mutableListOf<FilePath>()
try {
val request = popRequest() ?: let {
complete(emptyList())
return
}
val request = popRequest() ?: return
val (time, prediction) = measureSupplierTimeMillis { request.calculate() }
logEvent(project, ChangeReminderEvent.PREDICTION_CALCULATED, ChangeReminderData.EXECUTION_TIME, time)
complete(prediction)
result.addAll(prediction)
}
catch (e: ProcessCanceledException) {
complete(emptyList())
throw e
}
catch (_: Exception) {
}
finally {
complete(result)
}
}
}
val indicator = EmptyProgressIndicator()