make --json-error-messages capture url download errors
Convert Utility.Url to return Either String so the error message can be displated in the annex monad and so captured. (When curl is used, its errors are still not caught.)
This commit is contained in:
parent
99536e3a0b
commit
890330f0fe
16 changed files with 161 additions and 121 deletions
|
@ -95,7 +95,9 @@ newAssistantUrl repo = do
|
|||
- warp-tls listens to http, in order to show an error page, so this works.
|
||||
-}
|
||||
assistantListening :: URLString -> IO Bool
|
||||
assistantListening url = catchBoolIO $ exists url' =<< defUrlOptions
|
||||
assistantListening url = catchBoolIO $ do
|
||||
uo <- defUrlOptions
|
||||
(== Right True) <$> exists url' uo
|
||||
where
|
||||
url' = case parseURI url of
|
||||
Nothing -> url
|
||||
|
|
|
@ -40,9 +40,10 @@ import Utility.Metered
|
|||
import qualified Utility.Lsof as Lsof
|
||||
import qualified BuildInfo
|
||||
import qualified Utility.Url as Url
|
||||
import qualified Annex.Url as Url
|
||||
import qualified Annex.Url as Url hiding (download)
|
||||
import Utility.Tuple
|
||||
|
||||
import Data.Either
|
||||
import qualified Data.Map as M
|
||||
|
||||
{- Upgrade without interaction in the webapp. -}
|
||||
|
@ -323,8 +324,8 @@ downloadDistributionInfo = do
|
|||
liftIO $ withTmpDir "git-annex.tmp" $ \tmpdir -> do
|
||||
let infof = tmpdir </> "info"
|
||||
let sigf = infof ++ ".sig"
|
||||
ifM (Url.download nullMeterUpdate distributionInfoUrl infof uo
|
||||
<&&> Url.download nullMeterUpdate distributionInfoSigUrl sigf uo
|
||||
ifM (isRight <$> Url.download nullMeterUpdate distributionInfoUrl infof uo
|
||||
<&&> (isRight <$> Url.download nullMeterUpdate distributionInfoSigUrl sigf uo)
|
||||
<&&> verifyDistributionSig gpgcmd sigf)
|
||||
( parseInfoFile <$> readFileStrict infof
|
||||
, return Nothing
|
||||
|
|
|
@ -192,7 +192,7 @@ escapeHeader = escapeURIString (\c -> isUnescapedInURI c && c /= ' ')
|
|||
getRepoInfo :: RemoteConfig -> Widget
|
||||
getRepoInfo c = do
|
||||
uo <- liftAnnex Url.getUrlOptions
|
||||
exists <- liftIO $ catchDefaultIO False $ Url.exists url uo
|
||||
exists <- liftAnnex $ catchDefaultIO False $ Url.exists url uo
|
||||
[whamlet|
|
||||
<a href="#{url}">
|
||||
Internet Archive item
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue