11use crate :: multi_test:: address_generator:: InjectiveAddressGenerator ;
2-
3- use anyhow:: { bail, Result as AnyResult } ;
4- use cosmwasm_std:: { testing:: MockApi , Addr , Api , Binary , BlockInfo , Coin , CustomQuery , Empty , MemoryStorage , Querier , Storage } ;
5- use cosmwasm_std:: { to_json_binary, StdError } ;
2+ use cosmwasm_std:: { testing:: { MockApi , MockStorage } , Addr , Api , Binary , BlockInfo , Coin , CustomQuery , Empty , Querier , Storage , to_json_binary, StdError } ;
63use cw_multi_test:: {
74 no_init, AddressGenerator , App , AppResponse , BankKeeper , BasicAppBuilder , CosmosRouter , Module , StargateAccepting , StargateFailing , WasmKeeper ,
85} ;
@@ -19,7 +16,7 @@ pub enum StargateT {
1916 Failing ( StargateFailing ) ,
2017}
2118
22- pub type MockedInjectiveApp = App < BankKeeper , MockApi , MemoryStorage , CustomInjectiveHandler , WasmKeeper < InjectiveMsgWrapper , InjectiveQueryWrapper > > ;
19+ pub type MockedInjectiveApp = App < BankKeeper , MockApi , MockStorage , CustomInjectiveHandler , WasmKeeper < InjectiveMsgWrapper , InjectiveQueryWrapper > > ;
2320
2421#[ derive( Clone ) ]
2522pub struct InitialBalance {
@@ -194,7 +191,7 @@ impl Module for CustomInjectiveHandler {
194191 _block : & BlockInfo ,
195192 _sender : Addr ,
196193 msg : Self :: ExecT ,
197- ) -> AnyResult < AppResponse > {
194+ ) -> Result < AppResponse , StdError > {
198195 let mut exec_calls_count = self . state . execs . borrow ( ) . len ( ) ;
199196
200197 if !self . assertions . executes . is_empty ( )
@@ -230,11 +227,11 @@ impl Module for CustomInjectiveHandler {
230227 } ) ,
231228 & None => Ok ( AppResponse :: default ( ) ) ,
232229 } ,
233- Err ( e) => Err ( anyhow :: Error :: new ( StdError :: generic_err ( e. to_string ( ) ) ) ) ,
230+ Err ( e) => Err ( StdError :: msg ( e. to_string ( ) ) ) ,
234231 }
235232 }
236233
237- fn query ( & self , _api : & dyn Api , _storage : & dyn Storage , _querier : & dyn Querier , _block : & BlockInfo , request : Self :: QueryT ) -> AnyResult < Binary > {
234+ fn query ( & self , _api : & dyn Api , _storage : & dyn Storage , _querier : & dyn Querier , _block : & BlockInfo , request : Self :: QueryT ) -> Result < Binary , StdError > {
238235 let mut query_calls_count = self . state . queries . borrow ( ) . len ( ) ;
239236
240237 if !self . assertions . queries . is_empty ( )
@@ -263,7 +260,7 @@ impl Module for CustomInjectiveHandler {
263260 // and that's the reason why I'm manually copying the underlying [u8] in order to return owned data
264261 match & stored_result {
265262 Ok ( optional_data) => Ok ( copy_binary ( optional_data) ) ,
266- Err ( e) => Err ( anyhow :: Error :: new ( StdError :: generic_err ( e. to_string ( ) ) ) ) ,
263+ Err ( e) => Err ( StdError :: msg ( e. to_string ( ) ) ) ,
267264 }
268265 }
269266 }
@@ -275,8 +272,8 @@ impl Module for CustomInjectiveHandler {
275272 _router : & dyn CosmosRouter < ExecC = ExecC , QueryC = QueryC > ,
276273 _block : & BlockInfo ,
277274 msg : Self :: SudoT ,
278- ) -> AnyResult < AppResponse > {
279- bail ! ( "Unexpected sudo msg {:?}" , msg)
275+ ) -> Result < AppResponse , StdError > {
276+ Err ( StdError :: msg ( format ! ( "Unexpected sudo msg {:?}" , msg) ) )
280277 }
281278}
282279
0 commit comments