Skip to content

Commit c5b4944

Browse files
committed
chore(transactors): add additional error messaging for FailedToQuery receive errors
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 8322f9d commit c5b4944

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

services/opencode/src/main/kotlin/com/getcode/opencode/internal/transactors/ReceiveGiftCardTransactor.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ internal class ReceiveGiftCardTransactor(
5858
requestingOwner = requestingOwner
5959
).getOrElse {
6060
onStep("account query")
61-
return@timedTraceSuspend logAndFail(ReceiveGiftTransactorError.FailedToQuery())
61+
return@timedTraceSuspend logAndFail(ReceiveGiftTransactorError.FailedToQuery(cause = it))
6262
}.takeIf { it.accounts.isNotEmpty() }?.accounts
6363
?: run {
6464
onStep("account query")
65-
return@timedTraceSuspend logAndFail(ReceiveGiftTransactorError.FailedToQuery())
65+
return@timedTraceSuspend logAndFail(ReceiveGiftTransactorError.FailedToQuery(message = "No accounts found"))
6666
}
6767

6868
onStep("account query")
@@ -142,7 +142,10 @@ sealed class ReceiveGiftTransactorError(
142142
override val message: String? = null,
143143
override val cause: Throwable? = null
144144
) : CodeServerError(message, cause) {
145-
class FailedToQuery : GrabTransactorError(message = "Failed to query account")
145+
class FailedToQuery(
146+
override val message: String? = null,
147+
override val cause: Throwable? = null
148+
) : GrabTransactorError(message = message?.let { "Failed to query account - $it" } ?: "Failed to query account")
146149
class AlreadyClaimed : GrabTransactorError(message = "Already claimed")
147150
class UsersGiftCard : GrabTransactorError(message = "User is gift card issuer")
148151
class Expired : GrabTransactorError(message = "Expired")

0 commit comments

Comments
 (0)