mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 03:50:58 +00:00
core: add default messages to some error codes
This commit is contained in:
parent
341c5b7d10
commit
eabfcab9b9
@ -89,7 +89,7 @@ async def handle_GetFeatures(ctx: wire.Context, msg: GetFeatures) -> Features:
|
|||||||
|
|
||||||
|
|
||||||
async def handle_Cancel(ctx: wire.Context, msg: Cancel) -> NoReturn:
|
async def handle_Cancel(ctx: wire.Context, msg: Cancel) -> NoReturn:
|
||||||
raise wire.ActionCancelled("Cancelled")
|
raise wire.ActionCancelled
|
||||||
|
|
||||||
|
|
||||||
async def handle_ClearSession(ctx: wire.Context, msg: ClearSession) -> Success:
|
async def handle_ClearSession(ctx: wire.Context, msg: ClearSession) -> Success:
|
||||||
|
@ -106,10 +106,10 @@ async def hold_to_confirm(
|
|||||||
async def require_confirm(*args: Any, **kwargs: Any) -> None:
|
async def require_confirm(*args: Any, **kwargs: Any) -> None:
|
||||||
confirmed = await confirm(*args, **kwargs)
|
confirmed = await confirm(*args, **kwargs)
|
||||||
if not confirmed:
|
if not confirmed:
|
||||||
raise wire.ActionCancelled("Cancelled")
|
raise wire.ActionCancelled
|
||||||
|
|
||||||
|
|
||||||
async def require_hold_to_confirm(*args: Any, **kwargs: Any) -> None:
|
async def require_hold_to_confirm(*args: Any, **kwargs: Any) -> None:
|
||||||
confirmed = await hold_to_confirm(*args, **kwargs)
|
confirmed = await hold_to_confirm(*args, **kwargs)
|
||||||
if not confirmed:
|
if not confirmed:
|
||||||
raise wire.ActionCancelled("Cancelled")
|
raise wire.ActionCancelled
|
||||||
|
@ -41,7 +41,7 @@ async def recovery_process(ctx: wire.GenericContext) -> Success:
|
|||||||
storage.recovery.end_progress()
|
storage.recovery.end_progress()
|
||||||
else:
|
else:
|
||||||
storage.wipe()
|
storage.wipe()
|
||||||
raise wire.ActionCancelled("Cancelled")
|
raise wire.ActionCancelled
|
||||||
|
|
||||||
|
|
||||||
async def _continue_recovery_process(ctx: wire.GenericContext) -> Success:
|
async def _continue_recovery_process(ctx: wire.GenericContext) -> Success:
|
||||||
|
@ -113,7 +113,7 @@ async def _require_confirm_output(
|
|||||||
ui.GREEN,
|
ui.GREEN,
|
||||||
4,
|
4,
|
||||||
):
|
):
|
||||||
raise wire.ActionCancelled("Cancelled")
|
raise wire.ActionCancelled
|
||||||
|
|
||||||
|
|
||||||
async def _require_confirm_payment_id(ctx, payment_id: bytes):
|
async def _require_confirm_payment_id(ctx, payment_id: bytes):
|
||||||
@ -124,7 +124,7 @@ async def _require_confirm_payment_id(ctx, payment_id: bytes):
|
|||||||
ui.ICON_SEND,
|
ui.ICON_SEND,
|
||||||
ui.GREEN,
|
ui.GREEN,
|
||||||
):
|
):
|
||||||
raise wire.ActionCancelled("Cancelled")
|
raise wire.ActionCancelled
|
||||||
|
|
||||||
|
|
||||||
async def _require_confirm_fee(ctx, fee):
|
async def _require_confirm_fee(ctx, fee):
|
||||||
|
@ -44,7 +44,7 @@ async def add_resident_credential(
|
|||||||
"authenticator.",
|
"authenticator.",
|
||||||
)
|
)
|
||||||
await require_confirm(ctx, text, confirm=None, cancel="Close")
|
await require_confirm(ctx, text, confirm=None, cancel="Close")
|
||||||
raise wire.ActionCancelled("Cancelled") from None
|
raise wire.ActionCancelled
|
||||||
|
|
||||||
content = ConfirmContent(ConfirmAddCredential(cred))
|
content = ConfirmContent(ConfirmAddCredential(cred))
|
||||||
await require_confirm(ctx, content)
|
await require_confirm(ctx, content)
|
||||||
|
@ -27,7 +27,7 @@ class DataError(Error):
|
|||||||
|
|
||||||
|
|
||||||
class ActionCancelled(Error):
|
class ActionCancelled(Error):
|
||||||
def __init__(self, message: str) -> None:
|
def __init__(self, message: str = "Cancelled") -> None:
|
||||||
super().__init__(FailureType.ActionCancelled, message)
|
super().__init__(FailureType.ActionCancelled, message)
|
||||||
|
|
||||||
|
|
||||||
@ -37,12 +37,12 @@ class PinExpected(Error):
|
|||||||
|
|
||||||
|
|
||||||
class PinCancelled(Error):
|
class PinCancelled(Error):
|
||||||
def __init__(self, message: str) -> None:
|
def __init__(self, message: str = "PIN entry cancelled") -> None:
|
||||||
super().__init__(FailureType.PinCancelled, message)
|
super().__init__(FailureType.PinCancelled, message)
|
||||||
|
|
||||||
|
|
||||||
class PinInvalid(Error):
|
class PinInvalid(Error):
|
||||||
def __init__(self, message: str) -> None:
|
def __init__(self, message: str = "PIN invalid") -> None:
|
||||||
super().__init__(FailureType.PinInvalid, message)
|
super().__init__(FailureType.PinInvalid, message)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user