diff --git a/core/src/apps/base.py b/core/src/apps/base.py index 2c5b13b6c5..e50ea271aa 100644 --- a/core/src/apps/base.py +++ b/core/src/apps/base.py @@ -89,7 +89,7 @@ async def handle_GetFeatures(ctx: wire.Context, msg: GetFeatures) -> Features: 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: diff --git a/core/src/apps/common/confirm.py b/core/src/apps/common/confirm.py index b8ec7866c6..6e3a2f4b1f 100644 --- a/core/src/apps/common/confirm.py +++ b/core/src/apps/common/confirm.py @@ -106,10 +106,10 @@ async def hold_to_confirm( async def require_confirm(*args: Any, **kwargs: Any) -> None: confirmed = await confirm(*args, **kwargs) if not confirmed: - raise wire.ActionCancelled("Cancelled") + raise wire.ActionCancelled async def require_hold_to_confirm(*args: Any, **kwargs: Any) -> None: confirmed = await hold_to_confirm(*args, **kwargs) if not confirmed: - raise wire.ActionCancelled("Cancelled") + raise wire.ActionCancelled diff --git a/core/src/apps/management/recovery_device/homescreen.py b/core/src/apps/management/recovery_device/homescreen.py index 05891f038f..8514d0b0d9 100644 --- a/core/src/apps/management/recovery_device/homescreen.py +++ b/core/src/apps/management/recovery_device/homescreen.py @@ -41,7 +41,7 @@ async def recovery_process(ctx: wire.GenericContext) -> Success: storage.recovery.end_progress() else: storage.wipe() - raise wire.ActionCancelled("Cancelled") + raise wire.ActionCancelled async def _continue_recovery_process(ctx: wire.GenericContext) -> Success: diff --git a/core/src/apps/monero/layout/confirms.py b/core/src/apps/monero/layout/confirms.py index 6ae7454fc3..10b4425fbd 100644 --- a/core/src/apps/monero/layout/confirms.py +++ b/core/src/apps/monero/layout/confirms.py @@ -113,7 +113,7 @@ async def _require_confirm_output( ui.GREEN, 4, ): - raise wire.ActionCancelled("Cancelled") + raise wire.ActionCancelled 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.GREEN, ): - raise wire.ActionCancelled("Cancelled") + raise wire.ActionCancelled async def _require_confirm_fee(ctx, fee): diff --git a/core/src/apps/webauthn/add_resident_credential.py b/core/src/apps/webauthn/add_resident_credential.py index 3e4a83201b..83c225a5d8 100644 --- a/core/src/apps/webauthn/add_resident_credential.py +++ b/core/src/apps/webauthn/add_resident_credential.py @@ -44,7 +44,7 @@ async def add_resident_credential( "authenticator.", ) await require_confirm(ctx, text, confirm=None, cancel="Close") - raise wire.ActionCancelled("Cancelled") from None + raise wire.ActionCancelled content = ConfirmContent(ConfirmAddCredential(cred)) await require_confirm(ctx, content) diff --git a/core/src/trezor/wire/errors.py b/core/src/trezor/wire/errors.py index 1211536e8c..38ee739026 100644 --- a/core/src/trezor/wire/errors.py +++ b/core/src/trezor/wire/errors.py @@ -27,7 +27,7 @@ class DataError(Error): class ActionCancelled(Error): - def __init__(self, message: str) -> None: + def __init__(self, message: str = "Cancelled") -> None: super().__init__(FailureType.ActionCancelled, message) @@ -37,12 +37,12 @@ class PinExpected(Error): class PinCancelled(Error): - def __init__(self, message: str) -> None: + def __init__(self, message: str = "PIN entry cancelled") -> None: super().__init__(FailureType.PinCancelled, message) class PinInvalid(Error): - def __init__(self, message: str) -> None: + def __init__(self, message: str = "PIN invalid") -> None: super().__init__(FailureType.PinInvalid, message)