Skip to content

Generate Pretty Value Errors similar to option/argument validation #1234

Closed Answered by ryanmerolle
ryanmerolle asked this question in Questions
Discussion options

You must be logged in to vote

I used rich_utils.rich_format_error.

import click
from typer import rich_utils


class ContradictingOptionsError(click.ClickException):

    def __init__(self, message: str) -> None:
        super().__init__(message)
        self.exit_code = 1


rich_utils.rich_format_error(
    ContradictingOptionsError(
        "Contradicting options by setting both '--password' / '-p' and '--private-key' / '-pk'."
    )
)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ryanmerolle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
1 participant