Skip to main content

ErrorKind

Enum ErrorKind 

Source
pub enum ErrorKind {
Show 70 variants TildeWithoutValidHome, AssigningListToArrayMember, ConvertingAssociativeArrayToIndexedArray, ConvertingIndexedArrayToAssociativeArray, FailedSourcingFile(PathBuf, Error), FailedToSendSignal, CannotAssignToSpecialParameter, CheckedExpansionError(String), FunctionNotFound(String), CommandNotFound(String), BuiltinNotFound(String), WorkingDirMissing(PathBuf), FailedToExecuteCommand(String, Error), HistoryItemNotFound, Unimplemented(&'static str), UnimplementedAndTracked(&'static str, u32), MissingScope, MissingScopeForNewVariable, UnexpectedScopeType { expected: EnvironmentScope, actual: EnvironmentScope, }, NotADirectory(PathBuf), IsADirectory, NotArray, NoCurrentUser, InvalidRedirection, RedirectionFailure(String, String), EvalError(EvalError), IntParseError { s: String, int_type_name: &'static str, radix: u32, inner: ParseIntError, }, TryIntParseError(TryFromIntError), FromUtf8Error(FromUtf8Error), Utf8Error(Utf8Error), ReadonlyVariable, InvalidPattern(String), RegexError(Error), InvalidRegexError(Error, String), IoError(Error), BadSubstitution(String), ChildCreationFailure, FormattingError(Error), ParseError(ParseError, SourceInfo), FunctionParseError(String, ParseError), WordParseError(WordParseError), TestCommandParseError(TestCommandParseError), BindingParseError(BindingParseError), ThreadingError(JoinError), InvalidSignal(String), PlatformError(PlatformError), InvalidUmask, OpenFileNotReadable(&'static str), OpenFileNotWritable(&'static str), BadFileDescriptor(ShellFd), PrintfFailure(i32), PrintfInvalidUsage(String), Interrupted, MaxFunctionCallDepthExceeded, TimeError(SystemTimeError), ArrayIndexOutOfRange(String), UnhandledKeyCode(Vec<u8>), BuiltinError(Box<dyn BuiltinError>, String), NotSupportedOnThisPlatform(&'static str), HistoryNotEnabled, ExpandingUnsetVariable(String), InternalError(String), NotInInteractiveSession, NotExecutingCommandString, TooMuchData, CannotConvertToNativeFd, HistoryFileTooLargeToImport, TooManyOpenFiles, FunctionNameShadowsSpecialBuiltin { name: String, }, NoMatch(String),
}
Expand description

Monolithic error type for the shell

Variants§

§

TildeWithoutValidHome

A tilde expression was used without a valid HOME variable

§

AssigningListToArrayMember

An attempt was made to assign a list to an array member

§

ConvertingAssociativeArrayToIndexedArray

An attempt was made to convert an associative array to an indexed array.

§

ConvertingIndexedArrayToAssociativeArray

An attempt was made to convert an indexed array to an associative array.

§

FailedSourcingFile(PathBuf, Error)

An error occurred while sourcing the indicated script file.

§

FailedToSendSignal

The shell failed to send a signal to a process.

§

CannotAssignToSpecialParameter

An attempt was made to assign a value to a special parameter.

§

CheckedExpansionError(String)

Checked expansion error.

§

FunctionNotFound(String)

A reference was made to an unknown shell function.

§

CommandNotFound(String)

Command was not found.

§

BuiltinNotFound(String)

Not a builtin.

§

WorkingDirMissing(PathBuf)

The working directory does not exist.

§

FailedToExecuteCommand(String, Error)

Failed to execute command.

§

HistoryItemNotFound

History item was not found.

§

Unimplemented(&'static str)

The requested functionality has not yet been implemented in this shell.

§

UnimplementedAndTracked(&'static str, u32)

The requested functionality has not yet been implemented in this shell; it is tracked in a GitHub issue.

§

MissingScope

An expected environment scope could not be found.

§

MissingScopeForNewVariable

The environment scope required for a new variable is not available.

§

UnexpectedScopeType

An unexpected environment scope type was encountered.

Fields

§expected: EnvironmentScope

The expected scope type.

§actual: EnvironmentScope

The actual scope type.

§

NotADirectory(PathBuf)

The given path is not a directory.

§

IsADirectory

The given path is a directory.

§

NotArray

The given variable is not an array.

§

NoCurrentUser

The current user could not be determined.

§

InvalidRedirection

The requested input or output redirection is invalid.

§

RedirectionFailure(String, String)

An error occurred while redirecting input or output with the given file.

§

EvalError(EvalError)

An error occurred evaluating an arithmetic expression.

§

IntParseError

The given string could not be parsed as an integer.

Fields

§s: String

The string that failed to parse.

§int_type_name: &'static str

The integer type being parsed.

§radix: u32

The radix (base) used for parsing.

§inner: ParseIntError

The underlying parse error.

§

TryIntParseError(TryFromIntError)

The given integer could not be converted to the target type.

§

FromUtf8Error(FromUtf8Error)

A byte sequence could not be decoded as a valid UTF-8 string.

§

Utf8Error(Utf8Error)

A byte sequence could not be decoded as a valid UTF-8 string.

§

ReadonlyVariable

An attempt was made to modify a readonly variable.

§

InvalidPattern(String)

The indicated pattern is invalid.

§

RegexError(Error)

A regular expression error occurred

§

InvalidRegexError(Error, String)

An invalid regular expression was provided.

§

IoError(Error)

An I/O error occurred.

§

BadSubstitution(String)

Invalid substitution syntax.

§

ChildCreationFailure

An error occurred while creating a child process.

§

FormattingError(Error)

An error occurred while formatting a string.

§

ParseError(ParseError, SourceInfo)

An error occurred while parsing.

§

FunctionParseError(String, ParseError)

An error occurred while parsing a function body.

§

WordParseError(WordParseError)

An error occurred while parsing a word.

§

TestCommandParseError(TestCommandParseError)

Unable to parse a test command.

§

BindingParseError(BindingParseError)

Unable to parse a key binding specification.

§

ThreadingError(JoinError)

A threading error occurred.

§

InvalidSignal(String)

An invalid signal was referenced.

§

PlatformError(PlatformError)

A platform error occurred.

§

InvalidUmask

An invalid umask was provided.

§

OpenFileNotReadable(&'static str)

The given open file cannot be read from.

§

OpenFileNotWritable(&'static str)

The given open file cannot be written to.

§

BadFileDescriptor(ShellFd)

Bad file descriptor.

§

PrintfFailure(i32)

Printf failure

§

PrintfInvalidUsage(String)

Printf invalid usage

§

Interrupted

Interrupted

§

MaxFunctionCallDepthExceeded

Maximum function call depth was exceeded.

§

TimeError(SystemTimeError)

System time error.

§

ArrayIndexOutOfRange(String)

Array index out of range.

§

UnhandledKeyCode(Vec<u8>)

Unhandled key code.

§

BuiltinError(Box<dyn BuiltinError>, String)

An error occurred in a built-in command.

§

NotSupportedOnThisPlatform(&'static str)

Operation not supported on this platform.

§

HistoryNotEnabled

Command history is not enabled in this shell.

§

ExpandingUnsetVariable(String)

Expanding an unset variable.

§

InternalError(String)

An internal error occurred.

§

NotInInteractiveSession

Attempted to perform an operation that requires an interactive session.

§

NotExecutingCommandString

Attempted to perform an operation that requires command-string mode.

§

TooMuchData

Too much data was provided to an operation.

§

CannotConvertToNativeFd

Cannot convert open file to native file descriptor.

§

HistoryFileTooLargeToImport

History file is too large to import.

§

TooManyOpenFiles

Too many open files.

§

FunctionNameShadowsSpecialBuiltin

The function name shadows a special built-in command.

Fields

§name: String

Name of the function.

§

NoMatch(String)

A glob pattern failed to match any files (failglob).

Trait Implementations§

Source§

impl Debug for ErrorKind

Source§

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

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

impl Display for ErrorKind

Source§

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

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

impl Error for ErrorKind

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<&ErrorKind> for ExecutionExitCode

Source§

fn from(value: &ErrorKind) -> Self

Converts to this type from the input type.
Source§

impl From<BindingParseError> for ErrorKind

Source§

fn from(source: BindingParseError) -> Self

Converts to this type from the input type.
Source§

impl From<Errno> for ErrorKind

Source§

fn from(err: Errno) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ErrorKind

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ErrorKind

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ErrorKind

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<EvalError> for ErrorKind

Source§

fn from(source: EvalError) -> Self

Converts to this type from the input type.
Source§

impl From<FromUtf8Error> for ErrorKind

Source§

fn from(source: FromUtf8Error) -> Self

Converts to this type from the input type.
Source§

impl From<JoinError> for ErrorKind

Source§

fn from(source: JoinError) -> Self

Converts to this type from the input type.
Source§

impl From<PlatformError> for ErrorKind

Source§

fn from(source: PlatformError) -> Self

Converts to this type from the input type.
Source§

impl From<SystemTimeError> for ErrorKind

Source§

fn from(source: SystemTimeError) -> Self

Converts to this type from the input type.
Source§

impl From<TestCommandParseError> for ErrorKind

Source§

fn from(source: TestCommandParseError) -> Self

Converts to this type from the input type.
Source§

impl From<TryFromIntError> for ErrorKind

Source§

fn from(source: TryFromIntError) -> Self

Converts to this type from the input type.
Source§

impl From<Utf8Error> for ErrorKind

Source§

fn from(source: Utf8Error) -> Self

Converts to this type from the input type.
Source§

impl From<WordParseError> for ErrorKind

Source§

fn from(source: WordParseError) -> Self

Converts to this type from the input type.

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> ConvertibleToExitCode for T
where ExecutionExitCode: for<'a> From<&'a T>,

Source§

fn as_exit_code(&self) -> ExecutionExitCode

Converts to an exit code.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more