nu_errors

Struct ShellError

Source
pub struct ShellError {
    pub error: ProximateShellError,
    pub notes: Vec<String>,
}
Expand description

A ShellError is a proximate error and a possible cause, which could have its own cause, creating a cause chain.

Fields§

§error: ProximateShellError§notes: Vec<String>

Implementations§

Source§

impl ShellError

Source

pub fn type_error( expected: impl Into<String>, actual: Spanned<impl Into<String>>, ) -> ShellError

An error that describes a mismatch between the given type and the expected type

Source

pub fn missing_property( subpath: Spanned<impl Into<String>>, expr: Spanned<impl Into<String>>, ) -> ShellError

Source

pub fn missing_value( span: impl Into<Option<Span>>, reason: impl Into<String>, ) -> ShellError

Source

pub fn invalid_integer_index( subpath: Spanned<impl Into<String>>, integer: impl Into<Span>, ) -> ShellError

Source

pub fn untagged_runtime_error(error: impl Into<String>) -> ShellError

Source

pub fn unexpected_eof( expected: impl Into<String>, span: impl Into<Span>, ) -> ShellError

Source

pub fn range_error( expected: impl Into<ExpectedRange>, actual: &Spanned<impl Debug>, operation: impl Into<String>, ) -> ShellError

Source

pub fn syntax_error(problem: Spanned<impl Into<String>>) -> ShellError

Source

pub fn coerce_error( left: Spanned<impl Into<String>>, right: Spanned<impl Into<String>>, ) -> ShellError

Source

pub fn argument_error( command: Spanned<impl Into<String>>, kind: ArgumentError, ) -> ShellError

Source

pub fn diagnostic(diagnostic: Diagnostic<usize>) -> ShellError

Source

pub fn into_diagnostic(self) -> Diagnostic<usize>

Source

pub fn labeled_error( msg: impl Into<String>, label: impl Into<String>, span: impl Into<Span>, ) -> ShellError

Source

pub fn labeled_error_with_secondary( msg: impl Into<String>, primary_label: impl Into<String>, primary_span: impl Into<Span>, secondary_label: impl Into<String>, secondary_span: impl Into<Span>, ) -> ShellError

Source

pub fn unimplemented(title: impl Into<String>) -> ShellError

Source

pub fn unexpected(title: impl Into<String>) -> ShellError

Source

pub fn is_unimplemented(&self) -> bool

Trait Implementations§

Source§

impl Clone for ShellError

Source§

fn clone(&self) -> ShellError

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ShellError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ShellError

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ShellError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for ShellError

Source§

fn custom<T>(msg: T) -> Self
where T: Display,

Raised when there is general error when deserializing a type. Read more
Source§

fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self

Raised when a Deserialize receives a type different from what it was expecting. Read more
Source§

fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self

Raised when a Deserialize receives a value of the right type but that is wrong for some other reason. Read more
Source§

fn invalid_length(len: usize, exp: &dyn Expected) -> Self

Raised when deserializing a sequence or map and the input data contains too many or too few elements. Read more
Source§

fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self

Raised when a Deserialize enum type received a variant with an unrecognized name.
Source§

fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self

Raised when a Deserialize struct type received a field with an unrecognized name.
Source§

fn missing_field(field: &'static str) -> Self

Raised when a Deserialize struct type expected to receive a required field with a particular name but that field was not present in the input.
Source§

fn duplicate_field(field: &'static str) -> Self

Raised when a Deserialize struct type received more than one of the same field.
Source§

impl Error for ShellError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Box<dyn Error>> for ShellError

Source§

fn from(input: Box<dyn Error>) -> ShellError

Converts to this type from the input type.
Source§

impl From<Box<dyn Error + Send + Sync>> for ShellError

Source§

fn from(input: Box<dyn Error + Send + Sync>) -> ShellError

Converts to this type from the input type.
Source§

impl From<Error> for ShellError

Source§

fn from(input: Error) -> ShellError

Converts to this type from the input type.
Source§

impl From<Error> for ShellError

Source§

fn from(input: Error) -> ShellError

Converts to this type from the input type.
Source§

impl From<Error> for ShellError

Source§

fn from(input: Error) -> ShellError

Converts to this type from the input type.
Source§

impl From<Error> for ShellError

Source§

fn from(input: Error) -> ShellError

Converts to this type from the input type.
Source§

impl From<FromUtf8Error> for ShellError

Source§

fn from(input: FromUtf8Error) -> ShellError

Converts to this type from the input type.
Source§

impl From<ParseError> for ShellError

Convert a ParseError into a ShellError

Source§

fn from(error: ParseError) -> ShellError

Converts to this type from the input type.
Source§

impl From<PatternError> for ShellError

Source§

fn from(input: PatternError) -> ShellError

Converts to this type from the input type.
Source§

impl From<Utf8Error> for ShellError

Source§

fn from(input: Utf8Error) -> ShellError

Converts to this type from the input type.
Source§

impl HasFallibleSpan for ShellError

Source§

impl Hash for ShellError

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for ShellError

Source§

fn cmp(&self, other: &ShellError) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for ShellError

Source§

fn eq(&self, other: &ShellError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for ShellError

Source§

fn partial_cmp(&self, other: &ShellError) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PrettyDebug for ShellError

PrettyDebug is for internal debugging. For user-facing debugging, into_diagnostic is used, which prints an error, highlighting spans.

Source§

fn pretty(&self) -> DebugDocBuilder

Source§

fn to_doc(&self) -> DebugDoc

Source§

fn pretty_doc( &self, ) -> Doc<'static, BoxDoc<'static, ShellAnnotation>, ShellAnnotation>

Source§

fn pretty_builder(&self) -> DocBuilder<'static, BoxAllocator, ShellAnnotation>

Source§

fn display(&self) -> String

A convenience method that prints out the document without colors in 70 columns. Generally, you should use plain_string or colored_string if possible, but display() can be useful for trace lines and things like that, where you don’t have control over the terminal.
Source§

fn plain_string(&self, width: usize) -> String

Source§

fn colored_string(&self, width: usize) -> String

Source§

impl Serialize for ShellError

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for ShellError

Source§

impl StructuralPartialEq for ShellError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoSpanned for T
where T: HasFallibleSpan,

Source§

type Output = T

Source§

fn into_spanned(self, _span: impl Into<Span>) -> <T as IntoSpanned>::Output

Source§

impl<T> PrettyDebugWithSource for T
where T: PrettyDebug,

Source§

fn pretty_debug(&self, _source: &str) -> DebugDocBuilder

Source§

fn refined_pretty_debug( &self, _refine: PrettyDebugRefineKind, source: &str, ) -> DebugDocBuilder

Source§

fn debug(&self, source: impl Into<Text>) -> String
where Self: Clone,

Source§

fn debuggable(self, source: impl Into<Text>) -> DebuggableWithSource<Self>

Source§

impl<T> SpannedItem for T

Source§

fn spanned(self, span: impl Into<Span>) -> Spanned<Self>

Converts a value into a Spanned value
Source§

fn spanned_unknown(self) -> Spanned<Self>

Converts a value into a Spanned value, using an unknown Span
Source§

impl<T> TaggedItem for T

Source§

fn tagged(self, tag: impl Into<Tag>) -> Tagged<Self>

Source§

fn tagged_unknown(self) -> Tagged<Self>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,