Stream: git-wasmtime

Topic: wasmtime / issue #5416 Add specific error(s) for missing ...


view this post on Zulip Wasmtime GitHub notifications bot (Dec 12 2022 at 15:09):

lann opened issue #5416:

Feature

I'd like a specific error for missing imports on e.g. instantiate_pre.

Benefit

A specific error would give access to the missing import information without parsing the (presumably unstable) message string, and provide access to the missing import's type which is currently inaccessible.

Example code that would benefit from this: https://github.com/fermyon/spin/pull/959/files#diff-3df137e08da293bebdb5cbe1b81fcae6af75992a24c583f47e8040baecbf123aR259

Implementation

Copy the ImportType details into a new error struct:

pub struct UnknownImport {
  module: String,
  name: String,
  ty: ExternType,
}

Expose this info from a method e.g. import(&self) -> &ImportType or just AsRef<ImportType>.

Alternatives

New error type(s) could be returned from relevant methods rather than wrapping in anyhow::Error. This has been discussed in https://github.com/bytecodealliance/wasmtime/issues/3928.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 12 2022 at 15:10):

lann commented on issue #5416:

I'm happy to do the implementation for this if the approach works.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 12 2022 at 15:14):

lann edited issue #5416:

Feature

I'd like a specific error for missing imports on e.g. instantiate_pre.

Benefit

A specific error would give access to the missing import information without parsing the (presumably unstable) message string, and provide access to the missing import's type which is currently inaccessible.

Example code that would benefit from this: https://github.com/fermyon/spin/pull/959/files#diff-3df137e08da293bebdb5cbe1b81fcae6af75992a24c583f47e8040baecbf123aR259

Implementation

Copy the ImportType details into a new error struct:

pub struct UnknownImport {
  module: String,
  name: String,
  ty: ExternType,
}

Expose this info from a method e.g. import(&self) -> &ImportType or just AsRef<ImportType>.

Alternatives

view this post on Zulip Wasmtime GitHub notifications bot (Jan 03 2023 at 19:02):

alexcrichton closed issue #5416:

Feature

I'd like a specific error for missing imports on e.g. instantiate_pre.

Benefit

A specific error would give access to the missing import information without parsing the (presumably unstable) message string, and provide access to the missing import's type which is currently inaccessible.

Example code that would benefit from this: https://github.com/fermyon/spin/pull/959/files#diff-3df137e08da293bebdb5cbe1b81fcae6af75992a24c583f47e8040baecbf123aR259

Implementation

Copy the ImportType details into a new error struct:

pub struct UnknownImport {
  module: String,
  name: String,
  ty: ExternType,
}

Expose this info from a method e.g. import(&self) -> &ImportType or just AsRef<ImportType>.

Alternatives


Last updated: Nov 22 2024 at 16:03 UTC