Skip to content

Commit

Permalink
chore: improve messsaging with incompat wasm-instr versions
Browse files Browse the repository at this point in the history
  • Loading branch information
G4Vi committed Nov 9, 2023
1 parent a26ad97 commit 86cad75
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions rust/src/context.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::{bail, Context, Result};
use log::{error, warn};
use log::error;
use modsurfer_demangle::demangle_function_name;
use std::{
collections::HashMap,
Expand Down Expand Up @@ -435,7 +435,6 @@ pub fn add_to_linker<T: 'static>(

// check that the version number is supported with this SDK
if let Err(e) = wasm_instr_info.check_version() {
error!("{}", e);
return Err(e);
}
let t = FuncType::new([ValType::I32], []);
Expand Down
6 changes: 4 additions & 2 deletions rust/src/wasm_instr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ impl WasmInstrInfo {
let min_num = self.min_version.unwrap();

if maj_num != WASM_INSTR_VERSION_MAJOR {
bail!("wasm wasm-instr major version {maj_num} is not equal to {WASM_INSTR_VERSION_MAJOR}!")
bail!("Module wasm_instr_version_major {maj_num} is not equal to {WASM_INSTR_VERSION_MAJOR}!
Please reinstrument your module with compatible wasm-instr.")
}

if min_num < WASM_INSTR_VERSION_MINOR {
bail!(
"wasm wasm-instr minor version {min_num} is less than {WASM_INSTR_VERSION_MINOR}!"
"Module wasm_instr_version_minor {min_num} is less than {WASM_INSTR_VERSION_MINOR}!
Please reinstrument your module with the new version of wasm_instr."
);
}

Expand Down

0 comments on commit 86cad75

Please sign in to comment.