[sales] fix: do not crash when fetching state fails

This commit is contained in:
Mark Spanbroek 2023-02-01 14:07:20 +01:00
parent 083e341592
commit 8a8e7aed70
No known key found for this signature in database
GPG Key ID: FBE3E9548D427C00
1 changed files with 2 additions and 1 deletions

View File

@ -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: