Skip to content

Commit

Permalink
feat(law): impl into StdError on ContractError
Browse files Browse the repository at this point in the history
  • Loading branch information
bdeneux committed Mar 24, 2023
1 parent 7eccc7a commit d59b268
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions contracts/cw-law-stone/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use cw_utils::ParseReplyError;
use serde_json_wasm::de::Error;
use thiserror::Error;
use url::ParseError;
use crate::ContractError::Std;

#[derive(Error, Debug, PartialEq)]
pub enum ContractError {
Expand Down Expand Up @@ -47,3 +48,12 @@ pub enum UriError {
#[error("The given query is not compatible")]
IncompatibleQuery,
}

impl Into<StdError> for ContractError {
fn into(self) -> StdError {
match self {
Std(e) => e,
_ => StdError::generic_err(self.to_string()),
}
}
}

0 comments on commit d59b268

Please sign in to comment.