summaryrefslogtreecommitdiff
path: root/main/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'main/Main.hs')
-rw-r--r--main/Main.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/main/Main.hs b/main/Main.hs
index a0c28f7..e9c0ae4 100644
--- a/main/Main.hs
+++ b/main/Main.hs
@@ -924,13 +924,12 @@ cmdDiscoveryInit = void $ do
cmdDiscovery :: Command
cmdDiscovery = void $ do
Just peer <- gets csIcePeer
- st <- getStorage
sref <- asks ciLine
eprint <- asks ciPrint
- liftIO $ readRef st (BC.pack sref) >>= \case
- Nothing -> error "ref does not exist"
- Just ref -> do
- res <- runExceptT $ sendToPeer peer $ DiscoverySearch ref
+ case readRefDigest (BC.pack sref) of
+ Nothing -> throwOtherError "failed to parse ref"
+ Just dgst -> liftIO $ do
+ res <- runExceptT $ sendToPeer peer $ DiscoverySearch $ Right dgst
case res of
Right _ -> return ()
Left err -> eprint err