docs: improve

This commit is contained in:
James R. Barlow
2023-11-04 02:43:08 -07:00
parent 949265bbd0
commit 372c22d42b
2 changed files with 12 additions and 0 deletions
+10
View File
@@ -229,7 +229,17 @@ def cli_exception_handler(
options: argparse.Namespace,
plugin_manager: OcrmypdfPluginManager,
) -> ExitCode:
"""Convert exceptions into command line error messages and exit codes.
When known exceptions are raised, the exception message is printed to stderr
and the program exits with a non-zero exit code. When unknown exceptions are
raised, the exception traceback is printed to stderr and the program exits
with a non-zero exit code.
"""
try:
# We cannot use a generator and yield here, as would be the usual pattern
# for exception handling context managers, because we need to return an exit
# code.
return fn(options, plugin_manager)
except KeyboardInterrupt:
if options.verbose >= 1: