forked from extern/nushell
Add ErrSpan
extension trait for Result
(#12626)
# Description This adds an extension trait to `Result` that wraps errors in `Spanned`, saving the effort of calling `.map_err(|err| err.into_spanned(span))` every time. This will hopefully make it even more likely that someone will want to use a spanned `io::Error` and make it easier to remove the impl for `From<io::Error> for ShellError` because that doesn't have span information.
This commit is contained in:
@ -3550,8 +3550,7 @@ pub fn parse_where(working_set: &mut StateWorkingSet, lite_command: &LiteCommand
|
||||
pub fn parse_register(working_set: &mut StateWorkingSet, lite_command: &LiteCommand) -> Pipeline {
|
||||
use nu_plugin::{get_signature, PersistentPlugin, PluginDeclaration};
|
||||
use nu_protocol::{
|
||||
engine::Stack, IntoSpanned, PluginCacheItem, PluginIdentity, PluginSignature,
|
||||
RegisteredPlugin,
|
||||
engine::Stack, ErrSpan, PluginCacheItem, PluginIdentity, PluginSignature, RegisteredPlugin,
|
||||
};
|
||||
|
||||
let spans = &lite_command.parts;
|
||||
@ -3694,8 +3693,7 @@ pub fn parse_register(working_set: &mut StateWorkingSet, lite_command: &LiteComm
|
||||
let path = path.path_buf();
|
||||
|
||||
// Create the plugin identity. This validates that the plugin name starts with `nu_plugin_`
|
||||
let identity =
|
||||
PluginIdentity::new(path, shell).map_err(|err| err.into_spanned(path_span))?;
|
||||
let identity = PluginIdentity::new(path, shell).err_span(path_span)?;
|
||||
|
||||
// Find garbage collection config
|
||||
let gc_config = working_set
|
||||
|
Reference in New Issue
Block a user