refactor(tvix/eval/io): use io::Error instead of tvix_eval errors
We didn't return anything useful other than ErrorKind::IO anyways. We can use io::ErrorKind::Unsupported for DummyIO. Fixes b/271. Change-Id: Icb231e9b38168e8b6fa473bfa405d160357b317f Reviewed-on: https://cl.tvl.fyi/c/depot/+/8602 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
03958a5446
commit
b7ab6c0856
4 changed files with 70 additions and 63 deletions
|
|
@ -406,15 +406,27 @@ impl<'o> VM<'o> {
|
|||
}
|
||||
|
||||
VMRequest::PathImport(path) => {
|
||||
let imported =
|
||||
self.io_handle.import_path(&path).with_span(&span, self)?;
|
||||
let imported = self
|
||||
.io_handle
|
||||
.import_path(&path)
|
||||
.map_err(|e| ErrorKind::IO {
|
||||
path: Some(path),
|
||||
error: e.into(),
|
||||
})
|
||||
.with_span(&span, self)?;
|
||||
|
||||
message = VMResponse::Path(imported);
|
||||
}
|
||||
|
||||
VMRequest::ReadToString(path) => {
|
||||
let content =
|
||||
self.io_handle.read_to_string(path).with_span(&span, self)?;
|
||||
let content = self
|
||||
.io_handle
|
||||
.read_to_string(path.clone())
|
||||
.map_err(|e| ErrorKind::IO {
|
||||
path: Some(path),
|
||||
error: e.into(),
|
||||
})
|
||||
.with_span(&span, self)?;
|
||||
|
||||
message = VMResponse::Value(Value::String(content.into()))
|
||||
}
|
||||
|
|
@ -422,7 +434,11 @@ impl<'o> VM<'o> {
|
|||
VMRequest::PathExists(path) => {
|
||||
let exists = self
|
||||
.io_handle
|
||||
.path_exists(path)
|
||||
.path_exists(path.clone())
|
||||
.map_err(|e| ErrorKind::IO {
|
||||
path: Some(path),
|
||||
error: e.into(),
|
||||
})
|
||||
.map(Value::Bool)
|
||||
.with_span(&span, self)?;
|
||||
|
||||
|
|
@ -430,7 +446,14 @@ impl<'o> VM<'o> {
|
|||
}
|
||||
|
||||
VMRequest::ReadDir(path) => {
|
||||
let dir = self.io_handle.read_dir(path).with_span(&span, self)?;
|
||||
let dir = self
|
||||
.io_handle
|
||||
.read_dir(path.clone())
|
||||
.map_err(|e| ErrorKind::IO {
|
||||
path: Some(path),
|
||||
error: e.into(),
|
||||
})
|
||||
.with_span(&span, self)?;
|
||||
message = VMResponse::Directory(dir);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue