INNER CODE UNIT · Python

handle_general_exception

datachain-ai/datachain · src/datachain/cli/__init__.py:332

def handle_general_exception(exc, args, logging_level):
    error = str(exc)
    if isinstance(exc, KeyboardInterrupt):
        msg = "Operation cancelled by the user"
    else:
        msg = str(exc)
    print("Error:", msg, file=sys.stderr)
    if logging_level <= logging.DEBUG:
        traceback.print_exception(
            type(exc),
            exc,
            exc.__traceback__,
            file=sys.stderr,
        )
    if args.pdb:
        import pdb  # noqa: T100

        pdb.post_mortem()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…