forked from extern/nushell
make "can't follow stream paths" error a bit better (#10569)
related to - https://github.com/nushell/nushell/issues/9373 - https://github.com/nushell/nushell/issues/8639 might be able to close https://github.com/nushell/nushell/issues/8639? # Description "can't follow stream paths" errors have always been a bit scary and obnoxious because they give no information about what happens... in this PR i try to slightly improve the error message by telling if the stream was empty or not and give span information when available. # User-Facing Changes ```nushell > update value (get value) Error: nu:🐚:incompatible_path_access × Data cannot be accessed with a cell path ╭─[entry #1:1:1] 1 │ update value (get value) · ─┬─ · ╰── empty pipeline doesn't support cell paths ╰──── ``` ```nushell > ^echo "foo" | get 0 Error: nu:🐚:incompatible_path_access × Data cannot be accessed with a cell path ╭─[entry #2:1:1] 1 │ ^echo "foo" | get 0 · ──┬─ · ╰── external stream doesn't support cell paths ╰──── ``` # Tests + Formatting # After Submitting
This commit is contained in:
parent
7c1487e18d
commit
f481879ed3
@ -393,7 +393,14 @@ impl PipelineData {
|
||||
Value::list(stream.collect(), head).follow_cell_path(cell_path, insensitive)
|
||||
}
|
||||
PipelineData::Value(v, ..) => v.follow_cell_path(cell_path, insensitive),
|
||||
_ => Err(ShellError::IOError("can't follow stream paths".into())),
|
||||
PipelineData::Empty => Err(ShellError::IncompatiblePathAccess {
|
||||
type_name: "empty pipeline".to_string(),
|
||||
span: head,
|
||||
}),
|
||||
PipelineData::ExternalStream { span, .. } => Err(ShellError::IncompatiblePathAccess {
|
||||
type_name: "external stream".to_string(),
|
||||
span,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user