1
0
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:
Kelly Brazil
2021-05-20 15:46:31 -07:00
parent 0924d822a3
commit 6002af0dca

View File

@ -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