nim-codex/codex/purchasing/states/error.nim

14 lines
333 B
Nim

import ../statemachine
type PurchaseErrored* = ref object of PurchaseState
error*: ref CatchableError
method enter*(state: PurchaseErrored) =
without purchase =? (state.context as Purchase):
raiseAssert "invalid state"
purchase.future.fail(state.error)
method description*(state: PurchaseErrored): string =
"errored"