import click import sys class NccException(click.ClickException): def __init__(self, *args, log=None): super().__init__(*args) self.log = log def show(self, file=None) -> None: if self.log: click.echo(self.log) click.secho("ERROR: " + self.format_message(), file or sys.stderr, fg="red")