mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-01-10 21:15:59 +00:00
f459a2c6f6
Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com>
19 lines
564 B
Nim
19 lines
564 B
Nim
import pkg/chronicles
|
|
import ../statemachine
|
|
import ./errorhandling
|
|
import ./errored
|
|
|
|
logScope:
|
|
topics = "marketplace sales cancelled"
|
|
|
|
type
|
|
SaleCancelled* = ref object of ErrorHandlingState
|
|
SaleCancelledError* = object of CatchableError
|
|
SaleTimeoutError* = object of SaleCancelledError
|
|
|
|
method `$`*(state: SaleCancelled): string = "SaleCancelled"
|
|
|
|
method run*(state: SaleCancelled, machine: Machine): Future[?State] {.async.} =
|
|
let error = newException(SaleTimeoutError, "Sale cancelled due to timeout")
|
|
return some State(SaleErrored(error: error))
|