Skip to content

Improve error handling for .wasm importing - #241

Merged
SpaceManiac merged 8 commits into
mainfrom
tad/better-wasm-errors
Oct 1, 2026
Merged

SpaceManiac merged 8 commits into
mainfrom
tad/better-wasm-errors

Conversation

@SpaceManiac

@SpaceManiac SpaceManiac commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #236.

Main fixes:

  1. Skip functions which accept/return untranslateable types, rather than panicking.
  2. Report a TypeError E0060 if importing a .wasm file fails, rather than panicking.
  3. Restore the error on importing a file with an unknown extension, rather than silently ignoring it.

Also:

  • Merge common parts of TypeError and TypeWarning into a generic StarError<T>.
  • Add ImportWasmError type instead of using ad-hoc miette!() Reports.
  • Remove unused top-level Error type.
  • Combine ModuleGraphError::EntryIo and ImportIo, since keeping them separate complicates the implementation a bit.

Future work:

  • For functions which were skipped, error if they're imported, rather than acting as though they're not found.
  • Support importing functions which use record/variant types.
  • Support importing record/variant types themselves.
  • Support importing functions within interfaces, not just those bare on the world.

Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
@SpaceManiac
SpaceManiac requested a review from rvcas September 25, 2026 23:43
@SpaceManiac
SpaceManiac merged commit d9408a6 into main Oct 1, 2026
7 checks passed
@SpaceManiac
SpaceManiac deleted the tad/better-wasm-errors branch October 1, 2026 18:47
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

Successfully merging this pull request may close these issues.

1 participant