mirror of
https://github.com/nushell/nushell
synced 2025-01-14 22:24:54 +00:00
Fix error propagration across hash
commands (#493)
This commit is contained in:
parent
a5c1dd0da5
commit
a41ae72bc1
1 changed files with 7 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
use nu_engine::CallExt;
|
use nu_engine::CallExt;
|
||||||
use nu_protocol::ast::{Call, CellPath};
|
use nu_protocol::ast::{Call, CellPath};
|
||||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||||
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value};
|
use nu_protocol::{Example, PipelineData, ShellError, Signature, SyntaxShape, Value};
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
pub trait HashDigest: digest::Digest + Clone {
|
pub trait HashDigest: digest::Digest + Clone {
|
||||||
|
@ -90,6 +90,11 @@ where
|
||||||
Value::String { val, span } => (val.as_bytes(), *span),
|
Value::String { val, span } => (val.as_bytes(), *span),
|
||||||
Value::Binary { val, span } => (val.as_slice(), *span),
|
Value::Binary { val, span } => (val.as_slice(), *span),
|
||||||
other => {
|
other => {
|
||||||
|
let span = match input.span() {
|
||||||
|
Ok(span) => span,
|
||||||
|
Err(error) => return Value::Error { error },
|
||||||
|
};
|
||||||
|
|
||||||
return Value::Error {
|
return Value::Error {
|
||||||
error: ShellError::UnsupportedInput(
|
error: ShellError::UnsupportedInput(
|
||||||
format!(
|
format!(
|
||||||
|
@ -97,7 +102,7 @@ where
|
||||||
other.get_type(),
|
other.get_type(),
|
||||||
D::name()
|
D::name()
|
||||||
),
|
),
|
||||||
input.span().unwrap_or_else(|_| Span::unknown()),
|
span,
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue