/usr/lib/python3/dist-packages/argh/exceptions.py is in python3-argh 0.26.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | # coding: utf-8
#
# Copyright © 2010—2014 Andrey Mikhaylenko and contributors
#
# This file is part of Argh.
#
# Argh is free software under terms of the GNU Lesser
# General Public License version 3 (LGPLv3) as published by the Free
# Software Foundation. See the file README.rst for copying conditions.
#
"""
Exceptions
~~~~~~~~~~
"""
class AssemblingError(Exception):
"""
Raised if the parser could not be configured due to malformed
or conflicting command declarations.
"""
class DispatchingError(Exception):
"""
Raised if the dispatching could not be completed due to misconfiguration
which could not be determined on an earlier stage.
"""
class CommandError(Exception):
"""
Intended to be raised from within a command. The dispatcher wraps this
exception by default and prints its message without traceback.
Useful for print-and-exit tasks when you expect a failure and don't want
to startle the ordinary user by the cryptic output.
Consider the following example::
def foo(args):
try:
...
except KeyError as e:
print(u'Could not fetch item: {0}'.format(e))
return
It is exactly the same as::
def bar(args):
try:
...
except KeyError as e:
raise CommandError(u'Could not fetch item: {0}'.format(e))
This exception can be safely used in both print-style and yield-style
commands (see :doc:`tutorial`).
"""
|