mirror of
https://github.com/status-im/nim-dagger.git
synced 2025-03-01 06:40:54 +00:00
* fix(statemachine): do not raise from state.run * fix rebase * fix exception handling in SaleProvingSimulated.prove - re-raise CancelledError - don't return State on CatchableError - expect the Proofs_InvalidProof custom error instead of checking a string * asyncSpawn salesagent.onCancelled This was swallowing a KeyError in one of the tests (fixed in the previous commit) * remove error handling states in asyncstatemachine * revert unneeded changes * formatting * PR feedback, logging updates
27 lines
653 B
Nim
27 lines
653 B
Nim
import pkg/metrics
|
|
import ../statemachine
|
|
import ../../utils/exceptions
|
|
import ../../logutils
|
|
|
|
declareCounter(codex_purchases_error, "codex purchases error")
|
|
|
|
logScope:
|
|
topics = "marketplace purchases errored"
|
|
|
|
type PurchaseErrored* = ref object of PurchaseState
|
|
error*: ref CatchableError
|
|
|
|
method `$`*(state: PurchaseErrored): string =
|
|
"errored"
|
|
|
|
method run*(
|
|
state: PurchaseErrored, machine: Machine
|
|
): Future[?State] {.async: (raises: []).} =
|
|
codex_purchases_error.inc()
|
|
let purchase = Purchase(machine)
|
|
|
|
error "Purchasing error",
|
|
error = state.error.msgDetail, requestId = purchase.requestId
|
|
|
|
purchase.future.fail(state.error)
|