Refactor: Construct IoError from std::io::Error instead of std::io::ErrorKind (#15777)

This commit is contained in:
Piepmatz
2025-05-18 14:52:40 +02:00
committed by GitHub
parent c4dcfdb77b
commit 833471241a
80 changed files with 408 additions and 299 deletions

View File

@ -10,7 +10,8 @@ use nu_utils::perf;
use nu_plugin::{EvaluatedCall, PluginCommand};
use nu_protocol::{
Category, Example, LabeledError, PipelineData, ShellError, Signature, Span, Spanned,
SyntaxShape, Type, Value, shell_error::io::IoError,
SyntaxShape, Type, Value,
shell_error::{self, io::IoError},
};
use std::{fs::File, io::BufReader, num::NonZeroUsize, path::PathBuf, sync::Arc};
@ -193,7 +194,7 @@ fn command(
)),
},
None => Err(ShellError::Io(IoError::new_with_additional_context(
std::io::ErrorKind::NotFound,
shell_error::io::ErrorKind::from_std(std::io::ErrorKind::Other),
spanned_file.span,
PathBuf::from(spanned_file.item),
"File without extension",

View File

@ -16,7 +16,8 @@ use log::debug;
use nu_plugin::{EngineInterface, EvaluatedCall, PluginCommand};
use nu_protocol::{
Category, Example, LabeledError, PipelineData, ShellError, Signature, Span, Spanned,
SyntaxShape, Type, shell_error::io::IoError,
SyntaxShape, Type,
shell_error::{self, io::IoError},
};
use polars::error::PolarsError;
@ -212,7 +213,7 @@ fn command(
)),
},
None => Err(ShellError::Io(IoError::new_with_additional_context(
std::io::ErrorKind::NotFound,
shell_error::io::ErrorKind::FileNotFound,
resource.span,
Some(PathBuf::from(resource.path)),
"File without extension",