We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0003ca4 commit 5b76fc4Copy full SHA for 5b76fc4
packages/vm/src/modules/file_system_cache.rs
@@ -1,6 +1,7 @@
1
use std::fs;
2
use std::hash::Hash;
3
use std::io;
4
+use std::panic::catch_unwind;
5
use std::path::{Path, PathBuf};
6
use thiserror::Error;
7
@@ -166,9 +167,12 @@ impl FileSystemCache {
166
167
.map_err(|_e| VmError::cache_err("Error creating modules directory"))?;
168
169
let path = self.module_file(checksum);
- module
170
- .serialize_to_file(&path)
171
- .map_err(|e| VmError::cache_err(format!("Error writing module to disk: {e}")))?;
+ catch_unwind(|| {
+ module
172
+ .serialize_to_file(&path)
173
+ .map_err(|e| VmError::cache_err(format!("Error writing module to disk: {e}")))
174
+ })
175
+ .map_err(|_| VmError::cache_err("Could not write module to disk"))??;
176
let module_size = module_size(&path)?;
177
Ok(module_size)
178
}
0 commit comments