--json-exceptions
authorJoey Hess <joeyh@joeyh.name>
Tue, 25 Apr 2023 21:02:25 +0000 (17:02 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 25 Apr 2023 21:05:33 +0000 (17:05 -0400)
commita325524454fdc45a61f91844efb3065f6e34b318
tree0a4e452d3b95ea8fbc278e8685bb376023984ce2
parenta474c9c63bab9098a65eac849342e854c5fbf058
--json-exceptions

Added a --json-exceptions option, which makes some exceptions be output in json.

The distinction is that --json-error-messages is for messages relating
to a particular ActionItem, while --json-exceptions is for messages that
are not, eg ones for a file that does not exist.

It's unfortunate that we need two switches with such a fine distinction
between them, but I'm worried about maintaining backwards compatability
in the json output, to avoid breaking anything that parses it, and this was
the way to make sure I didn't.

toplevelWarning is generally used for the latter kind of message. And
the other calls to toplevelWarning could be converted to showException. The
only possible gotcha is that if toplevelWarning is ever called after
starting acting on a file, it will add to the --json-error-messages of the
json displayed for that file and converting to showException would be a
behavior change. That seems unlikely, but I didn't convery everything to
avoid needing to satisfy myself it was not a concern.

Sponsored-by: Dartmouth College's Datalad project
32 files changed:
CHANGELOG
CmdLine/GitAnnex/Options.hs
CmdLine/Seek.hs
Messages.hs
Messages/Internal.hs
Messages/JSON.hs
Messages/Serialized.hs
Types/Messages.hs
doc/git-annex-add.mdwn
doc/git-annex-addurl.mdwn
doc/git-annex-copy.mdwn
doc/git-annex-drop.mdwn
doc/git-annex-dropkey.mdwn
doc/git-annex-examinekey.mdwn
doc/git-annex-export.mdwn
doc/git-annex-find.mdwn
doc/git-annex-findkeys.mdwn
doc/git-annex-fsck.mdwn
doc/git-annex-get.mdwn
doc/git-annex-import.mdwn
doc/git-annex-info.mdwn
doc/git-annex-lock.mdwn
doc/git-annex-metadata.mdwn
doc/git-annex-mirror.mdwn
doc/git-annex-move.mdwn
doc/git-annex-registerurl.mdwn
doc/git-annex-status.mdwn
doc/git-annex-unlock.mdwn
doc/git-annex-unregisterurl.mdwn
doc/git-annex-whereis.mdwn
doc/todo/api_for_telling_when_nonexistant_or_non_git_files_passed/comment_3_3f0872f13160a77a82bd5a95fc3f397d._comment
doc/todo/api_for_telling_when_nonexistant_or_non_git_files_passed/comment_5_105453fbbe7361f3d409ab87079a8a41._comment [new file with mode: 0644]