mirror of
https://github.com/status-im/nim-dagger.git
synced 2025-01-31 17:06:19 +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
13 lines
343 B
Nim
13 lines
343 B
Nim
import ../statemachine
|
|
import ./error
|
|
|
|
type
|
|
PurchaseFailed* = ref object of PurchaseState
|
|
|
|
method `$`*(state: PurchaseFailed): string =
|
|
"failed"
|
|
|
|
method run*(state: PurchaseFailed, machine: Machine): Future[?State] {.async.} =
|
|
let error = newException(PurchaseError, "Purchase failed")
|
|
return some State(PurchaseErrored(error: error))
|