diff options
author | Linnea Gräf <nea@nea.moe> | 2024-12-23 02:22:06 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-12-23 02:22:06 +0100 |
commit | f0285e44ed113bcf2a11b5d6635f6124deb7fc3b (patch) | |
tree | 7ebcc5faaf014287f17696c501351447cbe8890d /src/main/kotlin/moe/nea/ledger/utils/ErrorUtil.kt | |
parent | 6b7f5b95b0541eb0e76855152e283e5f9cad0c3c (diff) | |
download | LocalTransactionLedger-f0285e44ed113bcf2a11b5d6635f6124deb7fc3b.tar.gz LocalTransactionLedger-f0285e44ed113bcf2a11b5d6635f6124deb7fc3b.tar.bz2 LocalTransactionLedger-f0285e44ed113bcf2a11b5d6635f6124deb7fc3b.zip |
feat: Add in game updater
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/utils/ErrorUtil.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/ledger/utils/ErrorUtil.kt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/utils/ErrorUtil.kt b/src/main/kotlin/moe/nea/ledger/utils/ErrorUtil.kt index 344c8bc..e0c83f9 100644 --- a/src/main/kotlin/moe/nea/ledger/utils/ErrorUtil.kt +++ b/src/main/kotlin/moe/nea/ledger/utils/ErrorUtil.kt @@ -4,6 +4,7 @@ import moe.nea.ledger.utils.di.Inject import moe.nea.ledger.utils.telemetry.ContextValue import moe.nea.ledger.utils.telemetry.EventRecorder import moe.nea.ledger.utils.telemetry.Span +import java.util.concurrent.CompletableFuture class ErrorUtil { @@ -27,6 +28,14 @@ class ErrorUtil { return getOrNull() } + fun <T : CompletableFuture<*>> listenToFuture(t: T): T { + t.handle { ignored, exception -> + if (exception != null) + report(exception, "Uncaught exception in completable future") + } + return t + } + inline fun <T> catch( vararg pairs: Pair<String, ContextValue>, crossinline function: () -> T |