mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-08-06 22:32:54 +02:00
add more error message detail to the user for ParseError and LibraryNotFound exceptions
This commit is contained in:
11
jc/cli.py
11
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
|
||||
|
Reference in New Issue
Block a user