From 4203355d7df7ba87361951ef1ff4b6412d2c9860 Mon Sep 17 00:00:00 2001 From: Izalia Mae Date: Fri, 23 Aug 2024 01:13:32 -0400 Subject: [PATCH] better error message when trying to set invalid config key --- relay/manage.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/relay/manage.py b/relay/manage.py index 5ae8238..d2525a0 100644 --- a/relay/manage.py +++ b/relay/manage.py @@ -362,10 +362,15 @@ def cli_config_list(ctx: click.Context) -> None: def cli_config_set(ctx: click.Context, key: str, value: Any) -> None: 'Set a config value' - with ctx.obj.database.session() as conn: - new_value = conn.put_config(key, value) + try: + with ctx.obj.database.session() as conn: + new_value = conn.put_config(key, value) - print(f'{key}: {repr(new_value)}') + except: + click.echo('Invalid config name:', key) + return + + click.echo(f'{key}: {repr(new_value)}') @cli.group('user')