Handle InsufficientBalanceException in API

This commit is contained in:
SKBotNL committed 2026-07-28 12:37:15 +02:00
1 parent 7c8e78967c
commit 53dc0b80e6
2 files changed
+2

No files matched your search

@@ -71,6 +71,7 @@ class DiamondBankAPIJava {
return runBlocking {
transactionLock.withLockSuspend(uuid) {
balanceManager.subtractFromBankShards(uuid, shards).getOrElse {
if (it is InsufficientBalanceException) throw it
handleError(it)
throw EconomyDisabledException()
}
@@ -65,6 +65,7 @@ class DiamondBankAPIKotlin {
return transactionLock.withLockSuspend(uuid) {
balanceManager.subtractFromBankShards(uuid, shards.toLong()).getOrElse {
if (it is InsufficientBalanceException) return@withLockSuspend Result.failure(it)
handleError(it)
return@withLockSuspend Result.failure(EconomyDisabledException())
}