def exception_handler()

in curator/cli.py [0:0]


def exception_handler(action_def, err):
    """Do the grunt work with the exception

    :param action_def: An action object
    :param err: The exception

    :type action_def: :py:class:`~.curator.classdef.ActionDef`
    :type err: :py:exc:`Exception`
    """
    logger = logging.getLogger(__name__)
    if isinstance(err, (NoIndices, NoSnapshots)):
        if action_def.iel:
            logger.info(
                'Skipping action "%s" due to empty list: %s',
                action_def.action,
                type(err),
            )
        else:
            logger.error(
                'Unable to complete action "%s".  No actionable items in list: %s',
                action_def.action,
                type(err),
            )
            sys.exit(1)
    else:
        logger.error(
            'Failed to complete action: %s.  %s: %s', action_def.action, type(err), err
        )
        if action_def.cif:
            logger.info(
                'Continuing execution with next action because "continue_if_exception" '
                'is set to True for action %s',
                action_def.action,
            )
        else:
            sys.exit(1)