Skip to content

Commit

Permalink
add error type
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioVentilii committed Dec 3, 2024
1 parent baaf66a commit f89e6e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/shared/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ pub mod dapp {
#[derive(CandidType, Deserialize, Clone, Eq, PartialEq, Debug)]
pub enum AddDappSettingsError {
DappIdAlreadyHidden,
DappIdTooLong,
UserNotFound,
VersionMismatch,
}
Expand All @@ -344,7 +345,7 @@ pub mod dapp {
pub const MAX_LEN: usize = 32;
/// Checks whether the request is syntactically valid
pub fn check() -> Result<(), 'static str> {
(self.dapp_id.len() < Self::MAX_LEN).then(()).ok_or("App name too long.")
(self.dapp_id.len() < Self::MAX_LEN).then(()).ok_or(AddDappSettingsError::DappIdTooLong)
}
}
}
Expand Down

0 comments on commit f89e6e5

Please sign in to comment.