diff --git a/jc/cli.py b/jc/cli.py index e11b09b3..14f7b983 100644 --- a/jc/cli.py +++ b/jc/cli.py @@ -16,6 +16,7 @@ import jc import jc.appdirs as appdirs import jc.utils import jc.tracebackplus +from jc.exceptions import LibraryNotInstalled, ParseError # make pygments import optional try: @@ -603,6 +604,16 @@ def main(): try: result = parser.parse(data, raw=raw, quiet=quiet) + except (ParseError, LibraryNotInstalled) as e: + if debug: + raise + else: + jc.utils.error_message( + f'Parser issue with {parser_name}:\n' + f' {e}\n' + ' For details use the -d or -dd option. Use "jc -h" for help.') + sys.exit(combined_exit_code(magic_exit_code, JC_ERROR_EXIT)) + except Exception: if debug: raise