diff options
author | Joey Hess <joey@kitenet.net> | 2014-08-06 13:45:19 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-08-06 13:45:19 -0400 |
commit | cc2606ce542e04c22cf229d536ad621f9e25c12d (patch) | |
tree | 27601f447942bcefbfcb89c6588f330d7580098c /Remote/Helper/Messages.hs | |
parent | 5cd02fd1a52b3f1c19b01f4a021a7c63b96796dd (diff) |
pushed checkPresent exception handling out of Remote implementations
I tend to prefer moving toward explicit exception handling, not away from
it, but in this case, I think there are good reasons to let checkPresent
throw exceptions:
1. They can all be caught in one place (Remote.hasKey), and we know
every possible exception is caught there now, which we didn't before.
2. It simplified the code of the Remotes. I think it makes sense for
Remotes to be able to be implemented without needing to worry about
catching exceptions inside them. (Mostly.)
3. Types.StoreRetrieve.Preparer can only work on things that return a
Bool, which all the other relevant remote methods already did.
I do not see a good way to generalize that type; my previous attempts
failed miserably.
Diffstat (limited to 'Remote/Helper/Messages.hs')
-rw-r--r-- | Remote/Helper/Messages.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Remote/Helper/Messages.hs b/Remote/Helper/Messages.hs index c4b1966dc..3088a9ab2 100644 --- a/Remote/Helper/Messages.hs +++ b/Remote/Helper/Messages.hs @@ -13,5 +13,5 @@ import qualified Git showChecking :: Git.Repo -> Annex () showChecking r = showAction $ "checking " ++ Git.repoDescribe r -cantCheck :: Git.Repo -> Either String Bool -cantCheck r = Left $ "unable to check " ++ Git.repoDescribe r +cantCheck :: Git.Repo -> a +cantCheck r = error $ "unable to check " ++ Git.repoDescribe r |