removed all uses of undefined from code base

It's a code smell, can lead to hard to diagnose error messages.
This commit is contained in:
Joey Hess 2015-04-19 00:38:29 -04:00
parent d7f4c823d7
commit addc82dab7
19 changed files with 42 additions and 37 deletions

View file

@ -199,7 +199,7 @@ tryGitConfigRead :: Git.Repo -> Annex Git.Repo
tryGitConfigRead r
| haveconfig r = return r -- already read
| Git.repoIsSsh r = store $ do
v <- Ssh.onRemote r (pipedconfig, return (Left undefined)) "configlist" [] []
v <- Ssh.onRemote r (pipedconfig, return (Left $ error "configlist failed")) "configlist" [] []
case v of
Right r'
| haveconfig r' -> return r'
@ -228,9 +228,10 @@ tryGitConfigRead r
uo <- Url.getUrlOptions
v <- liftIO $ withTmpFile "git-annex.tmp" $ \tmpfile h -> do
hClose h
ifM (Url.downloadQuiet (Git.repoLocation r ++ "/config") tmpfile uo)
let url = Git.repoLocation r ++ "/config"
ifM (Url.downloadQuiet url tmpfile uo)
( pipedconfig "git" [Param "config", Param "--null", Param "--list", Param "--file", File tmpfile]
, return $ Left undefined
, return $ Left $ error $ "unable to load config from " ++ url
)
case v of
Left _ -> do