Skip to content

Commit

Permalink
fix: ApiError & public assert_err_inner
Browse files Browse the repository at this point in the history
  • Loading branch information
chungquantin committed Oct 18, 2024
1 parent d804b5d commit 844e9a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions crates/pop-drink/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ macro_rules! assert_err {
}

#[track_caller]
#[allow(unused)]
fn assert_err_inner<R, E, Error>(result: Result<R, E>, expected_error: Error)
pub fn assert_err_inner<R, E, Error>(result: Result<R, E>, expected_error: Error)
where
E: Into<u32>,
Error: From<u32> + Into<u32> + Debug,
Expand Down
7 changes: 4 additions & 3 deletions crates/pop-drink/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub mod devnet {
pub use crate::error::*;

pub mod v0 {
pub use pop_api::primitives::v0::{self, *};
pub use pop_api::primitives::v0::{self, Error as ApiError, *};

/// Error type for writing tests (see `error` module).
pub type Error = crate::error::Error<v0::Error, pop_runtime_devnet::RuntimeError, 3>;
Expand Down Expand Up @@ -143,8 +143,9 @@ where
{
match session.call::<String, ()>(func_name, &input, endowment) {
// If the call is reverted, decode the error into the specified error type.
Err(SessionError::CallReverted(error)) =>
Err(E::decode(&mut &error[2..]).expect("Decoding failed")),
Err(SessionError::CallReverted(error)) => {
Err(E::decode(&mut &error[2..]).expect("Decoding failed"))
},
// If the call is successful, decode the last returned value.
Ok(_) => Ok(session
.record()
Expand Down

0 comments on commit 844e9a5

Please sign in to comment.