Skip to content

Commit

Permalink
Remove system specific detail from error message
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Aug 30, 2022
1 parent b53dc64 commit 0c34099
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/vm/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,12 @@ fn save_wasm_to_disk(dir: impl Into<PathBuf>, wasm: &[u8]) -> VmResult<Checksum>
fn load_wasm_from_disk(dir: impl Into<PathBuf>, checksum: &Checksum) -> VmResult<Vec<u8>> {
// this requires the directory and file to exist
let path = dir.into().join(checksum.to_hex());
let mut file = File::open(path)
.map_err(|e| VmError::cache_err(format!("Error opening Wasm file for reading: {}", e)))?;
let mut file =
File::open(path).map_err(|_e| VmError::cache_err("Error opening Wasm file for reading"))?;

let mut wasm = Vec::<u8>::new();
file.read_to_end(&mut wasm)
.map_err(|e| VmError::cache_err(format!("Error reading Wasm file: {}", e)))?;
.map_err(|_e| VmError::cache_err("Error reading Wasm file"))?;
Ok(wasm)
}

Expand Down Expand Up @@ -518,8 +518,7 @@ mod tests {

match cache.load_wasm(&checksum).unwrap_err() {
VmError::CacheErr { msg, .. } => {
assert!(msg
.starts_with("Error opening Wasm file for reading: No such file or directory"))
assert_eq!(msg, "Error opening Wasm file for reading")
}
e => panic!("Unexpected error: {:?}", e),
}
Expand Down

0 comments on commit 0c34099

Please sign in to comment.