Skip to content

Commit

Permalink
wasmi_cli: Display exported funcs for --invoke x when no func nam…
Browse files Browse the repository at this point in the history
…ed `x` is exported (#678)

* display exported funcs for invoke when not found

* apply rustfmt
  • Loading branch information
Robbepop committed Feb 14, 2023
1 parent 8b74585 commit 0a14f20
Showing 1 changed file with 4 additions and 2 deletions.
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

0 comments on commit 0a14f20

Please sign in to comment.