From 8a8e7aed70de6f8cc698ed7a35f0b4056d6f67e0 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Wed, 1 Feb 2023 14:07:20 +0100 Subject: [PATCH] [sales] fix: do not crash when fetching state fails --- codex/sales/states/unknown.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codex/sales/states/unknown.nim b/codex/sales/states/unknown.nim index e7b4df8e..93809d1c 100644 --- a/codex/sales/states/unknown.nim +++ b/codex/sales/states/unknown.nim @@ -25,7 +25,8 @@ method enterAsync(state: SaleUnknown) {.async.} = try: without requestState =? await market.requestState(agent.requestId): - raiseAssert "state unknown" + let error = newException(SaleUnknownError, "cannot retrieve request state") + await state.switchAsync(SaleErrored(error: error)) case requestState of RequestState.New, RequestState.Started: