fix(python/trezorctl): improve docs and behavior around unexpected messages

closes #2254
pull/2352/head
matejcik 2 years ago
parent 8c3d3c6548
commit c12e4edd70

@ -53,7 +53,10 @@ def cli() -> None:
@cli.command() @cli.command()
@with_client @with_client
def self_test(client: "TrezorClient") -> str: def self_test(client: "TrezorClient") -> str:
"""Perform a self-test.""" """Perform a factory self-test.
Only available on PRODTEST firmware.
"""
return debuglink.self_test(client) return debuglink.self_test(client)
@ -126,6 +129,7 @@ def load(
if not label: if not label:
label = "SLIP-0014" label = "SLIP-0014"
try:
return debuglink.load_device( return debuglink.load_device(
client, client,
mnemonic=list(mnemonic), mnemonic=list(mnemonic),
@ -137,6 +141,13 @@ def load(
needs_backup=needs_backup, needs_backup=needs_backup,
no_backup=no_backup, no_backup=no_backup,
) )
except exceptions.TrezorFailure as e:
if e.code == messages.FailureType.UnexpectedMessage:
raise click.ClickException(
"Unrecognized message. Make sure your Trezor is using debug firmware."
)
else:
raise
@cli.command() @cli.command()

Loading…
Cancel
Save