nginx-configurator/ncc/error.py
2024-11-04 22:25:33 +01:00

13 lines
343 B
Python

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")