diff options
author | Tim Harder <radhermit@gmail.com> | 2020-12-01 00:43:11 -0700 |
---|---|---|
committer | Tim Harder <radhermit@gmail.com> | 2020-12-01 00:53:33 -0700 |
commit | 8f4a955f99dec0d8ad84f409925086f7631109a6 (patch) | |
tree | 57b1cfb973e176d48cdeb0b6ee228b3690ab930b /src/pkgcheck/cli.py | |
parent | base: add PkgcheckUserException for user-facing exception output (diff) | |
download | pkgcheck-8f4a955f99dec0d8ad84f409925086f7631109a6.tar.gz pkgcheck-8f4a955f99dec0d8ad84f409925086f7631109a6.tar.bz2 pkgcheck-8f4a955f99dec0d8ad84f409925086f7631109a6.zip |
cli: use parser.error() to output PkgcheckUserException
So the error message is properly prefixed with the command being run.
Base PkgcheckExceptions are still outputted raw since they're generally
going to be raw pipeline tracebacks.
Diffstat (limited to 'src/pkgcheck/cli.py')
-rw-r--r-- | src/pkgcheck/cli.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pkgcheck/cli.py b/src/pkgcheck/cli.py index aab5356c..6e587591 100644 --- a/src/pkgcheck/cli.py +++ b/src/pkgcheck/cli.py @@ -10,7 +10,7 @@ from snakeoil.klass import jit_attr_none from snakeoil.contexts import patch from snakeoil.log import suppress_logging -from .base import PkgcheckException +from . import base class Tool(commandline.Tool): @@ -20,7 +20,9 @@ class Tool(commandline.Tool): with suppress_logging(): try: return super().main() - except PkgcheckException as e: + except base.PkgcheckUserException as e: + self.parser.error(str(e)) + except base.PkgcheckException as e: sys.exit(str(e)) |