Open thaJeztah opened 5 days ago
Attention: Patch coverage is 40.00000%
with 21 lines
in your changes missing coverage. Please review.
Project coverage is 61.46%. Comparing base (
61c6ff2
) to head (882d070
).
@laurazard first round of cleanup after the other one(s) 😄
The
reportError
utility was present because cli.StatusError would print the error decorated withStatus: <error-message>, Code: <exit-code>
. That was not desirable in many cases as it would mess-up the output. To prevent this, the CLI had code to check for an emptyStatus
(error message) in which case the error would be "ignored" (and only used for the exit-status), and thereportError
utility would be used to manually print a custom error message before returning the error.Now that bca209006153d3e025cb3d31c3cd55eb2aec0c4f fixed the output format of
cli.StatusError
, and 3dd6fc365d853e21f0e11f9e6ab62c4f8ae438e7 and 350a0b68a9584ec9ae712b6eca906c1018ba6dac no longer discard these error, we can get rid of this utility, and just set the error-message for the status-error.This patch:
withHelp
which takes care of decorating errors with a "Run --help" hint for the user.toStatusError
utility that detects certain errors in the container to assign a corresponding exit-code (these error-codes can be used to distinguish "client" errors from "container" errors).reportError
utility, and removes code that manually printed errors before returning.Behavior is mostly unmodified, with the exception of some slight reformatting of the errors:
withHelp
adds adocker:
prefix to the error, to indicate the error is produced by thedocker
command. This prefix was already present in most cases.Before this patch:
With this patch: