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

wasmi_cli: Display exported funcs for --invoke x when no func named x is exported #678

Merged
merged 2 commits into from
Feb 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
args::Args,
display::{DisplayExportedFuncs, DisplayFuncType, DisplaySequence, DisplayValue},
};
use anyhow::{bail, Error, Result};
use anyhow::{anyhow, bail, Error, Result};
use clap::Parser;
use context::Context;
use std::{path::Path, process};
Expand Down Expand Up @@ -87,7 +87,9 @@ fn typecheck_args(func_name: &str, func_ty: &FuncType, args: &[Value]) -> Result
fn get_invoked_func(args: &Args, ctx: &Context) -> Result<(String, Func), Error> {
match args.invoked() {
Some(func_name) => {
let func = ctx.get_func(func_name)?;
let func = ctx
.get_func(func_name)
.map_err(|error| anyhow!("{error}\n\n{}", DisplayExportedFuncs::from(ctx)))?;
let func_name = func_name.into();
Ok((func_name, func))
}
Expand Down