From 72d2554ea29358d987d7c02830e1459f5a88c2d1 Mon Sep 17 00:00:00 2001 From: David Butenhof Date: Wed, 21 Jan 2026 16:40:07 -0500 Subject: [PATCH] Improve reporting of validation errors Deserialization of some parameters like `--data` takes place during `run` rather than during option processing. It raises a `ValidationError`, but to the Click CLI infrastructure this is an unexpected exception and causes a full traceback which is not generally useful to the user. This change intercepts `ValidationError` (and for completeness the standard Python `ValueError`) and raises a Click `BadParameter` exception encapsulating the validation error text. This will be reported without traceback. Signed-off-by: David Butenhof --- src/guidellm/__main__.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/guidellm/__main__.py b/src/guidellm/__main__.py index d0fc89a19..72ba19e7a 100644 --- a/src/guidellm/__main__.py +++ b/src/guidellm/__main__.py @@ -462,17 +462,21 @@ def run(**kwargs): # noqa: C901 if uvloop is not None: asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) - asyncio.run( - benchmark_generative_text( - args=args, - progress=( - GenerativeConsoleBenchmarkerProgress() - if not disable_console_interactive - else None - ), - console=console, + + try: + asyncio.run( + benchmark_generative_text( + args=args, + progress=( + GenerativeConsoleBenchmarkerProgress() + if not disable_console_interactive + else None + ), + console=console, + ) ) - ) + except (ValidationError, ValueError) as err: + raise click.BadParameter(str(err)) from err @benchmark.command(