slobs-cli/src/slobs_cli/errors.py
onyx-and-iris d33c209d7c add custom error class SlobsCliError
add exception group handling for all commands that may raise exceptions

add comments to for-else blocks
2025-06-12 05:28:54 +01:00

14 lines
354 B
Python

import asyncclick as click
class SlobsCliError(click.ClickException):
"""Base class for all Slobs CLI errors."""
def __init__(self, message: str):
super().__init__(message)
self.exit_code = 1
def show(self):
"""Display the error message in red."""
click.secho(f"Error: {self.message}", fg="red", err=True)