Skip to content

Commit

Permalink
optimise error mapping for LimitOrderType::try_from calls
Browse files Browse the repository at this point in the history
  • Loading branch information
sotnikov-s committed Dec 15, 2023
1 parent 7aa5287 commit 1736dcf
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions contracts/dex_stargate/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ pub fn execute(
token_out,
tick_index_in_to_out,
amount_in,
order_type: LimitOrderType::try_from(order_type)
.map_err(|e| StdError::generic_err(e.to_string()))?,
order_type: LimitOrderType::try_from(order_type).map_err(StdError::generic_err)?,
expiration_time,
max_amount_out,
})),
Expand Down Expand Up @@ -330,8 +329,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
token_out,
tick_index_in_to_out,
amount_in,
order_type: LimitOrderType::try_from(order_type)
.map_err(|e| StdError::generic_err(e.to_string()))?,
order_type: LimitOrderType::try_from(order_type).map_err(StdError::generic_err)?,
expiration_time,
max_amount_out,
},
Expand Down

0 comments on commit 1736dcf

Please sign in to comment.