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

Export wasmer::sys::module::IoCompileError #3267

Closed
jvff opened this issue Oct 30, 2022 · 1 comment
Closed

Export wasmer::sys::module::IoCompileError #3267

jvff opened this issue Oct 30, 2022 · 1 comment
Labels
bug Something isn't working priority-medium Medium priority issue
Milestone

Comments

@jvff
Copy link

jvff commented Oct 30, 2022

Motivation

There's an error type returned from Module::from_file that is public but isn't exported from the crate. It's therefore impossible to import that type to match against the error in a project that uses the wasmer crate.

It's also impossible to do something like

#[derive(Debug, thiserror::Error)]
pub enum CustomError {
    #[error("Failed to load Wasm module")]
    InvalidModule(#[from] wasmer::IoCompileError), // How to import `IoCompileError`?

    // ...
}

Solutions

The simplest solution might be to just export the error type from the root module of the wasmer crate.

An alternative is to change the error type returned by Module::from_file, if the IoCompileError shouldn't be public.

@syrusakbary syrusakbary added priority-medium Medium priority issue bug Something isn't working labels Nov 8, 2022
@syrusakbary syrusakbary added this to the v3.0 milestone Nov 8, 2022
bors bot added a commit that referenced this issue Nov 16, 2022
3311: Export Module::IoCompileError as it's an error returned by an exported function r=ptitSeb a=ptitSeb

# Description
Export Module::IoCompileError as it's an error returned by an exported function (for #3267 )

Co-authored-by: ptitSeb <[email protected]>
@fschutt
Copy link
Contributor

fschutt commented Dec 6, 2022

Fixed in #3311, closing.

@fschutt fschutt closed this as completed Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

3 participants