summaryrefslogtreecommitdiff
path: root/CmdLine
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 /CmdLine
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 'CmdLine')
-rw-r--r--CmdLine/GitRemoteTorAnnex.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/CmdLine/GitRemoteTorAnnex.hs b/CmdLine/GitRemoteTorAnnex.hs
index c4bf26c85..5208a47ca 100644
--- a/CmdLine/GitRemoteTorAnnex.hs
+++ b/CmdLine/GitRemoteTorAnnex.hs
@@ -34,8 +34,8 @@ run (_remotename:address:[]) = forever $ do
| otherwise = parseAddressPort address
go service = do
ready
- res <- connectService onionaddress onionport service
- exitWith (fromMaybe (ExitFailure 1) res)
+ either giveup exitWith
+ =<< connectService onionaddress onionport service
ready = do
putStrLn ""
hFlush stdout
@@ -50,7 +50,7 @@ parseAddressPort s =
Nothing -> giveup "onion address must include port number"
Just p -> (OnionAddress a, p)
-connectService :: OnionAddress -> OnionPort -> Service -> IO (Maybe ExitCode)
+connectService :: OnionAddress -> OnionPort -> Service -> IO (Either String ExitCode)
connectService address port service = do
state <- Annex.new =<< Git.CurrentRepo.get
Annex.eval state $ do