Skip to content

A peer-to-peer stack for code collaboration

Improve display of send! and receive!

Thomas Scholtesd69d0e64e008
diff --git a/src/Radicle/Internal/HttpStorage.hs b/src/Radicle/Internal/HttpStorage.hs
index 3795e46..59a1c49 100644
--- a/src/Radicle/Internal/HttpStorage.hs
+++ b/src/Radicle/Internal/HttpStorage.hs
@@ -94,7 +94,7 @@ httpStoragePrimFns' mgr =
\ chain located at the URL for evaluation."
, \url values -> do
res <- liftIO $ runClientM' url mgr (submit $ toList values)
- pure $ bimap fmtError (const ()) res
+ pure $ bimap formatServantError (const ()) res
)
, storageReceive =
( "receive!"
@@ -102,13 +102,14 @@ httpStoragePrimFns' mgr =
\ for the last `n` inputs that have been evaluated."
, \url index -> do
res <- liftIO $ runClientM' url mgr (since index)
- pure $ first show res
+ pure $ first formatServantError res
)
}
where
- fmtError = \case
+ formatServantError = \case
FailureResponse Response{..} ->
"status code: " <> show (fromEnum responseStatusCode) <> "\n" <> toS responseBody
+ ConnectionError err -> err
se -> show se
submit :: [Value] -> ClientM Value
diff --git a/src/Radicle/Internal/Storage.hs b/src/Radicle/Internal/Storage.hs
index 09ed60a..62035bb 100644
--- a/src/Radicle/Internal/Storage.hs
+++ b/src/Radicle/Internal/Storage.hs
@@ -72,7 +72,7 @@ buildStoragePrimFns backend =
res <- lift $ receive id n
case res of
Left err -> throwErrorHere . OtherError
- $ receiveName <> ": request failed: " <> show err
+ $ receiveName <> ": request failed: " <> err
Right v' -> pure $ List v'
(String _, v) -> throwErrorHere $ TypeError receiveName 1 TNumber v
(v, _) -> throwErrorHere $ TypeError receiveName 0 TString v