convert listImportableContents to throwing exceptions

This commit is contained in:
Joey Hess 2020-12-22 14:20:11 -04:00
parent 5d8e4a7c74
commit e1ac42be77
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
8 changed files with 27 additions and 27 deletions

View file

@ -334,9 +334,9 @@ listContents remote importtreeconfig ci tvar = starting "list" ai si $
listContents' :: Remote -> ImportTreeConfig -> CheckGitIgnore -> (ImportableContents (ContentIdentifier, Remote.ByteSize) -> Annex a) -> Annex a
listContents' remote importtreeconfig ci a =
makeImportMatcher remote >>= \case
Right matcher -> getImportableContents remote importtreeconfig ci matcher >>= \case
Just importable -> a importable
Nothing -> giveup $ "Unable to list contents of " ++ Remote.name remote
Right matcher -> tryNonAsync (getImportableContents remote importtreeconfig ci matcher) >>= \case
Right importable -> a importable
Left e -> giveup $ "Unable to list contents of " ++ Remote.name remote ++ ": " ++ show e
Left err -> giveup $ unwords
[ "Cannot import from"
, Remote.name remote