Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define top-level basecoin error type #186

Open
seanchen1991 opened this issue Jun 4, 2024 · 0 comments
Open

Define top-level basecoin error type #186

seanchen1991 opened this issue Jun 4, 2024 · 0 comments
Assignees

Comments

@seanchen1991
Copy link
Contributor

Following along with the theme of improving error-handling in ibc-rs, we should define a top-level error type in basecoin that will serve as basecoin's host error type for when basecoin errors need to be propagated and handled by ibc-rs.

@rnbguy's example suggestion:

impl<S> ClientValidationContext for IbcContext<S>
where
    S: Store + Debug,
{
    type HostError = BasecoinError<S>;
    
    ...
}

impl<S> ClientExecutionContext for IbcContext<S>
where
    S: Store + Debug,
{
    fn store_client_state(
        &mut self,
        client_state_path: ClientStatePath,
        client_state: Self::ClientStateMut,
    ) -> Result<(), ContextError<Self::HostError<S>>> {
        self.client_state_store
            .set(client_state_path, client_state)
            .map(|_| ())
            // currently, we forget about the actual host error
            // and just do:
            // .map_err(|_| ClientError::Other { ... })
            .map_err(|err| ClientError::Generic(GenericError::Host(err)))?
        Ok(())
    }
    ...
}
@seanchen1991 seanchen1991 self-assigned this Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant