mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-08-08 22:36:48 +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.appdirs as appdirs
|
||||||
import jc.utils
|
import jc.utils
|
||||||
import jc.tracebackplus
|
import jc.tracebackplus
|
||||||
|
from jc.exceptions import LibraryNotInstalled, ParseError
|
||||||
|
|
||||||
# make pygments import optional
|
# make pygments import optional
|
||||||
try:
|
try:
|
||||||
@ -603,6 +604,16 @@ def main():
|
|||||||
try:
|
try:
|
||||||
result = parser.parse(data, raw=raw, quiet=quiet)
|
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:
|
except Exception:
|
||||||
if debug:
|
if debug:
|
||||||
raise
|
raise
|
||||||
|
Reference in New Issue
Block a user