catch all (non-async) exceptions when running a commandAction

When a command is operating on multiple files and there's an error with
one, try harder to continue to the rest. (As was already done for many
types of errors including IO errors.)

This handles cases like lockContentForRemoval throwing an exception when
the content is already locked. Just because a drop of one file fails, does
not mean it shouldn't go on to try to drop other files.

I looked over uses of `giveup` in Command/*; there are too many to check
them all extensively, but none stood out as being problems that should let
one commandAction stop running other commandActions. Worst case, something
bad will happen and rather than stopping right away with an error,
git-annex will display multiple errors as it fails over and over on each
file. I don't think I ever really intended `error`/`giveup` to stop other
commandActions; this was a relic of old confusion over haskell exception
handling.

Test suite passes.

This commit was sponsored by Ethan Aubin.
This commit is contained in:
Joey Hess 2018-11-15 15:59:43 -04:00
parent c8bd5710b1
commit 39fbaa0682
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 17 additions and 3 deletions

View file

@ -29,3 +29,15 @@ local repository version: 5
Linux ip-172-31-87-156 4.14.72-68.55.amzn1.x86_64 #1 SMP Fri Sep 28 21:14:54 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
### Please provide any additional information below.
> Made drop not operate on the same key multiple times concurrently.
>
> Also yeah, that kind of exception should not interrupt processing other
> files; the distinction git-annex has drawn between IO errors and other
> exceptions is not super useful unless a command for some reason wants to
> completely stop everything for some reason. I can't think of any cases
> where a command would want to do that; if it does turn out to be needed,
> a special type of exception could be thrown to force termination.
> So I changed it to catch all (non-async) errors.
>
> [[fixed|done]] --[[Joey]]