mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-01-19 01:12:34 +00:00
3181361658
* [state machine] Allow querying of state properties * [purchasing] use new state machine * [state machine] remove old state machine implementation * [purchasing] remove duplication in error handling
12 lines
318 B
Nim
12 lines
318 B
Nim
import ../statemachine
|
|
|
|
type PurchaseErrored* = ref object of PurchaseState
|
|
error*: ref CatchableError
|
|
|
|
method `$`*(state: PurchaseErrored): string =
|
|
"errored"
|
|
|
|
method run*(state: PurchaseErrored, machine: Machine): Future[?State] {.async.} =
|
|
let purchase = Purchase(machine)
|
|
purchase.future.fail(state.error)
|