Enum Error

Source
pub enum Error {
Show 15 variants OpenScriptNotFound, CommandFailed { message: String, }, Timeout { duration: Duration, }, ScriptWriteError { source: Error, }, ScriptReadError { path: String, source: Error, }, InvalidScriptPath { path: String, reason: String, }, InvalidWorkingDirectory { path: String, source: Error, }, InvalidEnvironmentVariable { key: String, reason: String, }, ProcessSpawnError { source: Error, }, ProcessWaitError { source: Error, }, OutputCaptureError { source: Error, }, PermissionDenied, Interrupted { signal: i32, }, ResourceLimitExceeded { resource: String, limit: String, }, IoError { context: String, source: Error, },
}
Expand description

Errors that can occur when running OpenScript commands.

Variants§

§

OpenScriptNotFound

OpenScript executable was not found in PATH or at the specified location.

§

CommandFailed

A command failed to execute.

Fields

§message: String

The error message describing what went wrong.

§

Timeout

The command timed out.

Fields

§duration: Duration

The duration after which the timeout occurred.

§

ScriptWriteError

Failed to write script content to temporary file.

Fields

§source: Error

The underlying I/O error.

§

ScriptReadError

Failed to read script file.

Fields

§path: String

The path to the script file that couldn’t be read.

§source: Error

The underlying I/O error.

§

InvalidScriptPath

Invalid script path provided.

Fields

§path: String

The invalid path that was provided.

§reason: String

The reason why the path is invalid.

§

InvalidWorkingDirectory

Working directory does not exist or is not accessible.

Fields

§path: String

The path to the invalid working directory.

§source: Error

The underlying I/O error.

§

InvalidEnvironmentVariable

Environment variable contains invalid characters.

Fields

§key: String

The environment variable key.

§reason: String

The reason why the variable is invalid.

§

ProcessSpawnError

Process spawning failed.

Fields

§source: Error

The underlying I/O error.

§

ProcessWaitError

Process wait failed.

Fields

§source: Error

The underlying I/O error.

§

OutputCaptureError

Output capture failed.

Fields

§source: Error

The underlying I/O error.

§

PermissionDenied

Permission denied when executing script.

§

Interrupted

Script execution was interrupted.

Fields

§signal: i32

The signal that interrupted execution.

§

ResourceLimitExceeded

Resource limit exceeded during execution.

Fields

§resource: String

The type of resource that exceeded limits.

§limit: String

The limit that was exceeded.

§

IoError

Generic I/O error with context.

Fields

§context: String

Context about what I/O operation failed.

§source: Error

The underlying I/O error.

Implementations§

Source§

impl Error

Source

pub fn command_failed<S: Into<String>>(message: S) -> Self

Create a new command failed error.

Source

pub fn timeout(duration: Duration) -> Self

Create a new timeout error.

Source

pub fn script_write_error(source: Error) -> Self

Create a new script write error.

Source

pub fn script_read_error<S: Into<String>>(path: S, source: Error) -> Self

Create a new script read error.

Source

pub fn invalid_script_path<P: Into<String>, R: Into<String>>( path: P, reason: R, ) -> Self

Create a new invalid script path error.

Source

pub fn invalid_working_directory<P: Into<String>>( path: P, source: Error, ) -> Self

Create a new invalid working directory error.

Source

pub fn invalid_environment_variable<K: Into<String>, R: Into<String>>( key: K, reason: R, ) -> Self

Create a new invalid environment variable error.

Source

pub fn process_spawn_error(source: Error) -> Self

Create a new process spawn error.

Source

pub fn process_wait_error(source: Error) -> Self

Create a new process wait error.

Source

pub fn output_capture_error(source: Error) -> Self

Create a new output capture error.

Source

pub fn interrupted(signal: i32) -> Self

Create a new interrupted error.

Source

pub fn resource_limit_exceeded<R: Into<String>, L: Into<String>>( resource: R, limit: L, ) -> Self

Create a new resource limit exceeded error.

Source

pub fn io_error<C: Into<String>>(context: C, source: Error) -> Self

Create a new I/O error with context.

Source

pub fn is_retryable(&self) -> bool

Check if this error is retryable.

Source

pub fn user_message(&self) -> String

Get a user-friendly error message with suggestions.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

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<Error> for Error

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Error

§

impl !RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl !UnwindSafe for Error

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> 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> 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.