1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-04-20 17:19:01 +00:00

chore(core): remove redundant Error messages

[no changelog]
This commit is contained in:
obrusvit 2025-04-04 16:43:26 +02:00 committed by Vít Obrusník
parent 69ce947d71
commit ad9f85b21d
4 changed files with 34 additions and 61 deletions

View File

@ -26,7 +26,8 @@ use crate::{
util::{ConfirmValueParams, PropsList, RecoveryType},
},
ui_firmware::{
FirmwareUI, MAX_CHECKLIST_ITEMS, MAX_GROUP_SHARE_LINES, MAX_WORD_QUIZ_ITEMS,
FirmwareUI, ERROR_NOT_IMPLEMENTED, MAX_CHECKLIST_ITEMS, MAX_GROUP_SHARE_LINES,
MAX_WORD_QUIZ_ITEMS,
},
ModelUI,
},
@ -135,7 +136,7 @@ impl FirmwareUI for UIBolt {
_hold: bool,
_chunkify: bool,
) -> Result<Gc<LayoutObj>, Error> {
Err::<Gc<LayoutObj>, Error>(Error::ValueError(c"confirm_value_intro not implemented"))
Err::<Gc<LayoutObj>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn confirm_homescreen(
@ -574,18 +575,14 @@ impl FirmwareUI for UIBolt {
_summary_br_name: Option<TString<'static>>,
_cancel_text: Option<TString<'static>>,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"flow_confirm_output not supported",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn flow_confirm_set_new_pin(
_title: TString<'static>,
_description: TString<'static>,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"flow_confirm_set_new_pin not supported",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn flow_get_address(
@ -603,9 +600,7 @@ impl FirmwareUI for UIBolt {
_br_code: u16,
_br_name: TString<'static>,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"flow_get_address not supported",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn multiple_pages_texts(
@ -613,15 +608,11 @@ impl FirmwareUI for UIBolt {
_verb: TString<'static>,
_items: Gc<List>,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"multiple_pages_texts not implemented",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn prompt_backup() -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"prompt_backup not implemented",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn request_bip39(
@ -817,7 +808,7 @@ impl FirmwareUI for UIBolt {
_value: TString<'static>,
_verb_cancel: Option<TString<'static>>,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(c"show_danger not supported"))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn show_error(
@ -1039,7 +1030,7 @@ impl FirmwareUI for UIBolt {
_text_footer: Option<TString<'static>>,
_text_confirm: TString<'static>,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(c"use show_share_words"))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn show_remaining_shares(pages_iterable: Obj) -> Result<impl LayoutMaybeTrace, Error> {
@ -1161,7 +1152,7 @@ impl FirmwareUI for UIBolt {
}
fn tutorial() -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(c"tutorial not supported"))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
}

View File

@ -26,7 +26,8 @@ use crate::{
util::{ConfirmValueParams, RecoveryType},
},
ui_firmware::{
FirmwareUI, MAX_CHECKLIST_ITEMS, MAX_GROUP_SHARE_LINES, MAX_WORD_QUIZ_ITEMS,
FirmwareUI, ERROR_NOT_IMPLEMENTED, MAX_CHECKLIST_ITEMS, MAX_GROUP_SHARE_LINES,
MAX_WORD_QUIZ_ITEMS,
},
ModelUI,
},
@ -183,7 +184,7 @@ impl FirmwareUI for UICaesar {
_hold: bool,
_chunkify: bool,
) -> Result<Gc<LayoutObj>, Error> {
Err::<Gc<LayoutObj>, Error>(Error::ValueError(c"confirm_value_intro not implemented"))
Err::<Gc<LayoutObj>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn confirm_homescreen(
@ -222,9 +223,7 @@ impl FirmwareUI for UICaesar {
_items: Obj,
_verb: Option<TString<'static>>,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"confirm_emphasized not implemented",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn confirm_fido(
@ -704,18 +703,14 @@ impl FirmwareUI for UICaesar {
_summary_br_name: Option<TString<'static>>,
_cancel_text: Option<TString<'static>>,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"flow_confirm_output not supported",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn flow_confirm_set_new_pin(
_title: TString<'static>,
_description: TString<'static>,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"flow_confirm_set_new_pin not supported",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn flow_get_address(
@ -733,9 +728,7 @@ impl FirmwareUI for UICaesar {
_br_code: u16,
_br_name: TString<'static>,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"flow_get_address not supported",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn multiple_pages_texts(
@ -925,9 +918,7 @@ impl FirmwareUI for UICaesar {
}
fn set_brightness(_current_brightness: Option<u8>) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"setting brightness not supported",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn show_address_details(
@ -992,7 +983,7 @@ impl FirmwareUI for UICaesar {
_value: TString<'static>,
_verb_cancel: Option<TString<'static>>,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(c"show_danger not supported"))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn show_error(
@ -1002,7 +993,7 @@ impl FirmwareUI for UICaesar {
_allow_cancel: bool,
_time_ms: u32,
) -> Result<Gc<LayoutObj>, Error> {
Err::<Gc<LayoutObj>, Error>(Error::ValueError(c"show error not supported"))
Err::<Gc<LayoutObj>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn show_group_share_success(
@ -1063,9 +1054,7 @@ impl FirmwareUI for UICaesar {
_horizontal: bool,
_chunkify: bool,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"show_info_with_cancel not supported",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn show_lockscreen(
@ -1155,13 +1144,11 @@ impl FirmwareUI for UICaesar {
_text_footer: Option<TString<'static>>,
_text_confirm: TString<'static>,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(c"use show_share_words"))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn show_remaining_shares(_pages_iterable: Obj) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"show remaining shares not supported",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn show_simple(
@ -1182,7 +1169,7 @@ impl FirmwareUI for UICaesar {
_allow_cancel: bool,
_time_ms: u32,
) -> Result<Gc<LayoutObj>, Error> {
Err::<Gc<LayoutObj>, Error>(Error::ValueError(c"show success not supported"))
Err::<Gc<LayoutObj>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn show_wait_text(text: TString<'static>) -> Result<impl LayoutMaybeTrace, Error> {

View File

@ -25,7 +25,8 @@ use crate::{
util::{PropsList, RecoveryType},
},
ui_firmware::{
FirmwareUI, MAX_CHECKLIST_ITEMS, MAX_GROUP_SHARE_LINES, MAX_WORD_QUIZ_ITEMS,
FirmwareUI, ERROR_NOT_IMPLEMENTED, MAX_CHECKLIST_ITEMS, MAX_GROUP_SHARE_LINES,
MAX_WORD_QUIZ_ITEMS,
},
ModelUI,
},
@ -81,7 +82,7 @@ impl FirmwareUI for UIDelizia {
_chunkify: bool,
) -> Result<Gc<LayoutObj>, Error> {
// confirm_value is used instead
Err::<Gc<LayoutObj>, Error>(Error::ValueError(c"confirm_address not implemented"))
Err::<Gc<LayoutObj>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn confirm_value(
@ -347,9 +348,7 @@ impl FirmwareUI for UIDelizia {
_hold: bool,
_items: Obj,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"confirm_more not implemented",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn confirm_reset_device(recovery: bool) -> Result<impl LayoutMaybeTrace, Error> {
@ -652,9 +651,7 @@ impl FirmwareUI for UIDelizia {
_verb: TString<'static>,
_items: Gc<List>,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"multiple_pages_texts not implemented",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn prompt_backup() -> Result<impl LayoutMaybeTrace, Error> {
@ -780,9 +777,7 @@ impl FirmwareUI for UIDelizia {
_path: Option<TString<'static>>,
_xpubs: Obj,
) -> Result<impl LayoutMaybeTrace, Error> {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"show_address_details not implemented",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn show_checklist(
@ -1027,9 +1022,7 @@ impl FirmwareUI for UIDelizia {
fn show_remaining_shares(_pages_iterable: Obj) -> Result<impl LayoutMaybeTrace, Error> {
// Delizia: remaining shares is a part of `continue_recovery` flow
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
c"show_remaining_shares not implemented",
))
Err::<RootComponent<Empty, ModelUI>, Error>(ERROR_NOT_IMPLEMENTED)
}
fn show_simple(

View File

@ -15,6 +15,8 @@ pub const MAX_CHECKLIST_ITEMS: usize = 3;
pub const MAX_WORD_QUIZ_ITEMS: usize = 3;
pub const MAX_GROUP_SHARE_LINES: usize = 4;
pub const ERROR_NOT_IMPLEMENTED: Error = Error::ValueError(c"not implemented");
pub trait FirmwareUI {
#[allow(clippy::too_many_arguments)]
fn confirm_action(