You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fndecoded<T:Decode>(result:ExecReturnValue) -> T{match <T>::decode(&mut&result.data[2..]){Ok(value) => value,Err(_) => panic!("\nTest failed by trying to decode `{:?}` into `T`\n", result),}}
At the moment, any method failed will end up at line 13:39 which is inside the decoded method. This is very hard to debug. My recommendation is to refactor the decoded method to return Result<T> so it can streamline the error back to the main function. Something like:
fndecoded<T:Decode>(result:ExecReturnValue) -> Result<T>{
<T>::decode(&mut&result.data[2..]).map_err("\nTest failed by trying to decode `{:?}` into `T`\n", result)}
The text was updated successfully, but these errors were encountered:
Daanvdplas
changed the title
refractor: contract integration test should streamline the error for better testing
refactor: contract integration test should streamline the error for better testing
Jul 26, 2024
cc: @Daanvdplas
At the moment, any method failed will end up at line
13:39
which is inside thedecoded
method. This is very hard to debug. My recommendation is to refactor thedecoded
method to returnResult<T>
so it can streamline the error back to the main function. Something like:The text was updated successfully, but these errors were encountered: