[starter] Simplify method

GitOrigin-RevId: d35ee862c518e9be12194cede107f6dc832e0f0b
This commit is contained in:
Maxim.Kolmakov
2024-06-28 13:20:21 +02:00
committed by intellij-monorepo-bot
parent d2fba3447f
commit 3b811a054d

View File

@@ -16,17 +16,13 @@ object EventsBus {
val SHARED_EVENTS_FLOW = SharedEventsFlow(LocalEventBusServerClient(LocalEventBusServer), EVENTS_FLOW)
fun executeWithExceptionHandling(ignoreExceptions: Boolean = true, block: () -> Unit) {
try {
block()
}
catch (t: Throwable) {
if (ignoreExceptions) {
LOG.info("Ignored: $t")
runCatching { block() }.onFailure { t ->
if (ignoreExceptions) {
LOG.info("Ignored: $t")
} else {
throw t
}
}
else {
throw t
}
}
}
/**