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

11 lines
262 B
Nim
Raw Normal View History

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