--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
This commit is contained in:
parent
a474c9c63b
commit
a325524454
32 changed files with 304 additions and 81 deletions
|
@ -445,13 +445,20 @@ jsonOptions =
|
|||
<> help "include error messages in JSON"
|
||||
<> hidden
|
||||
)
|
||||
, annexFlag (setAnnexState $ Annex.setOutput (JSONOutput jsonexceptionsoptions))
|
||||
( long "json-exceptions"
|
||||
<> help "include exceptions in JSON"
|
||||
<> hidden
|
||||
)
|
||||
]
|
||||
where
|
||||
stdjsonoptions = JSONOptions
|
||||
{ jsonProgress = False
|
||||
, jsonErrorMessages = False
|
||||
, jsonExceptions = False
|
||||
}
|
||||
jsonerrormessagesoptions = stdjsonoptions { jsonErrorMessages = True }
|
||||
jsonexceptionsoptions = stdjsonoptions { jsonExceptions = True }
|
||||
|
||||
jsonProgressOption :: [AnnexOption]
|
||||
jsonProgressOption =
|
||||
|
@ -465,6 +472,7 @@ jsonProgressOption =
|
|||
jsonoptions = JSONOptions
|
||||
{ jsonProgress = True
|
||||
, jsonErrorMessages = False
|
||||
, jsonExceptions = False
|
||||
}
|
||||
|
||||
-- Note that a command that adds this option should wrap its seek
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue