summaryrefslogtreecommitdiff
path: root/Command/P2P.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-12-08 15:47:49 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-12-08 15:47:49 -0400
commitfaa56834d282c6bb9b3338ed7514f2e0665d166f (patch)
treec68477884041f5faa7ceb775cd79830ad48a5f5a /Command/P2P.hs
parent1e7d212d4c0112e5b6b4872d84934fc85aa70315 (diff)
convert P2P runners from Maybe to Either String
So we get some useful error messages when things fail. This commit was sponsored by Peter Hogg on Patreon.
Diffstat (limited to 'Command/P2P.hs')
-rw-r--r--Command/P2P.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Command/P2P.hs b/Command/P2P.hs
index db69eff97..ea4dd7c65 100644
--- a/Command/P2P.hs
+++ b/Command/P2P.hs
@@ -85,7 +85,7 @@ linkRemote remotename = do
u <- getUUID
v <- liftIO $ runNetProto conn $ P2P.auth u authtoken
case v of
- Just (Just theiruuid) -> do
+ Right (Just theiruuid) -> do
ok <- inRepo $ Git.Command.runBool
[ Param "remote", Param "add"
, Param remotename
@@ -95,5 +95,6 @@ linkRemote remotename = do
storeUUIDIn (remoteConfig remotename "uuid") theiruuid
storeP2PRemoteAuthToken addr authtoken
return ok
- _ -> giveup "Unable to authenticate with peer. Please check the address and try again."
+ Right Nothing -> giveup "Unable to authenticate with peer. Please check the address and try again."
+ Left e -> giveup $ "Unable to authenticate with peer: " ++ e
connerror e = giveup $ "Unable to connect with peer. Please check that the peer is connected to the network, and try again. (" ++ show e ++ ")"