Fall back when remote filesystem walk is unavailable

This commit is contained in:
jif-oai
2026-06-26 02:43:14 +01:00
parent 0d4351c1b8
commit 60655e8b41
2 changed files with 29 additions and 4 deletions
+15 -2
View File
@@ -29,6 +29,7 @@ use crate::protocol::FsWalkParams;
use crate::protocol::FsWriteFileParams;
const INVALID_REQUEST_ERROR_CODE: i64 = -32600;
const METHOD_NOT_FOUND_ERROR_CODE: i64 = -32601;
const NOT_FOUND_ERROR_CODE: i64 = -32004;
#[path = "remote_file_stream.rs"]
@@ -194,14 +195,26 @@ impl RemoteFileSystem {
) -> FileSystemResult<WalkOutcome> {
trace!("remote fs walk");
let client = self.client.get().await.map_err(map_remote_error)?;
let response = client
let response = match client
.fs_walk(FsWalkParams {
path: path.clone(),
options,
sandbox: remote_sandbox_context(sandbox),
})
.await
.map_err(map_remote_error)?;
{
Ok(response) => response,
Err(ExecServerError::Server {
code: METHOD_NOT_FOUND_ERROR_CODE,
..
}) => {
return <Self as ExecutorFileSystem>::walk_via_directory_reads(
self, path, options, sandbox,
)
.await;
}
Err(error) => return Err(map_remote_error(error)),
};
Ok(response)
}