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()
@with_client
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)
@ -126,17 +129,25 @@ def load(
if not label:
label = "SLIP-0014"
return debuglink.load_device(
client,
mnemonic=list(mnemonic),
pin=pin,
passphrase_protection=passphrase_protection,
label=label,
language="en-US",
skip_checksum=ignore_checksum,
needs_backup=needs_backup,
no_backup=no_backup,
)
try:
return debuglink.load_device(
client,
mnemonic=list(mnemonic),
pin=pin,
passphrase_protection=passphrase_protection,
label=label,
language="en-US",
skip_checksum=ignore_checksum,
needs_backup=needs_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()

Loading…
Cancel
Save