-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
507d702
commit 90e065c
Showing
3 changed files
with
18 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
use cosmwasm_std::{Addr, StdError}; | ||
|
||
pub fn no_role_error(address: &Addr, role: &str) -> StdError { | ||
StdError::generic_err(format!("Address {} does not have role {}", address, role)) | ||
} | ||
pub fn insufficient_permissions_error() -> StdError { | ||
StdError::generic_err("Insufficient permissions") | ||
pub fn no_role_error(address: &Addr, role: Option<&str>) -> StdError { | ||
let role_str = role | ||
.map(|role| format!(" '{}'", role)) | ||
.unwrap_or(String::new()); | ||
StdError::generic_err(format!( | ||
"Address {} does not have required role{}", | ||
address, role_str | ||
)) | ||
} | ||
|
||
pub fn sender_is_not_role_admin_error<T: AsRef<str>>(role: &T) -> StdError { | ||
StdError::generic_err(format!("Sender is not admin of role '{}'", role.as_ref())) | ||
pub fn sender_is_not_role_admin_error(role: &str) -> StdError { | ||
StdError::generic_err(format!("Sender is not admin of the '{}' role", role)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters