From 8733cea902fc80f51fc671714e1cc0650f01ffe1 Mon Sep 17 00:00:00 2001 From: aarshkshah1992 Date: Wed, 31 Mar 2021 09:44:53 +0530 Subject: [PATCH] fix success handling in retreival --- cli/client.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cli/client.go b/cli/client.go index 1dcd59e72..31435bc1c 100644 --- a/cli/client.go +++ b/cli/client.go @@ -1195,14 +1195,21 @@ var clientRetrieveCmd = &cli.Command{ retrievalmarket.ClientEvents[evt.Event], retrievalmarket.DealStatuses[evt.Status], ) - } else { - afmt.Println("Success") - return nil } if evt.Err != "" { return xerrors.Errorf("retrieval failed: %s", evt.Err) } + + if !ok { + if evt.Status == retrievalmarket.DealStatusCompleted { + afmt.Println("Success") + return nil + } + + return xerrors.Errorf("saw final deal state %s instead of expected state DealStatusCompleted", retrievalmarket.DealStatuses[evt.Status]) + } + case <-ctx.Done(): return xerrors.Errorf("retrieval timed out") }