Swap to context fail method on error

This commit is contained in:
up-n-atom
2024-01-02 20:19:46 -05:00
committed by GitHub
parent 958b322145
commit 73a1645bbe
+2 -4
View File
@@ -44,8 +44,7 @@ async def cli(ctx: click.Context, host: IPv4Address, username: str, password: st
try:
await client.login()
except Exception as e:
click.echo(e, err=True)
raise click.Abort()
ctx.fail(e)
@cli.command()
@@ -74,8 +73,7 @@ async def set_value(ctx: click.Context, path: str, value: str) -> None:
try:
value = await client.set_value_by_xpath(path, value)
except Exception as e:
click.echo(e, err=True)
raise click.Abort()
ctx.fail(e)
@asynccontextmanager