Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 15 variants NotFound { kind: ObjectKind, name: String, available: Vec<String>, }, AlreadyExists { kind: ObjectKind, name: String, }, NameTaken { kind: ObjectKind, name: String, }, InvalidName { kind: ObjectKind, name: String, reason: String, }, OutOfBounds { what: &'static str, index: usize, len: usize, }, InvalidRange(String), EmptyWorkbook, LastSheetInWorkbook, DocumentModuleExists, InvalidArgument(String), Xlsx(String), Vba(String), VbaSyntax { message: String, module: Option<String>, line: u32, column: u32, }, VbaRuntime { message: String, number: i32, }, Eval(EngineError),
}
Expand description

Errors returned by visi-core’s public API.

This enum is #[non_exhaustive]: match with a _ arm, since new variants may be added in a minor release.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

NotFound

No object of this kind goes by this name (or id, for charts).

Fields

§kind: ObjectKind

What was being looked up.

§name: String

The name that was not found.

§available: Vec<String>

The names that do exist, when the call can supply them cheaply, so callers can render a “did you mean” hint. Often empty.

§

AlreadyExists

An object of this kind already goes by this name, so it cannot be added.

Fields

§kind: ObjectKind

What was being added.

§name: String

The name that collided.

§

NameTaken

A rename was rejected because the new name is already in use.

Distinct from Error::AlreadyExists, which is raised when creating.

Fields

§kind: ObjectKind

What was being renamed.

§name: String

The requested new name.

§

InvalidName

A name was rejected as structurally invalid, independent of collisions.

Fields

§kind: ObjectKind

What was being named.

§name: String

The rejected name.

§reason: String

Why it was rejected.

§

OutOfBounds

A row or column index fell outside the sheet.

Fields

§what: &'static str

What was being indexed (“row” or “column”).

§index: usize

The offending 0-based index.

§len: usize

The number of rows/columns that exist.

§

InvalidRange(String)

A cell range was malformed – for example, an end before its start.

§

EmptyWorkbook

The operation needs at least one sheet and the workbook has none.

§

LastSheetInWorkbook

The last remaining sheet cannot be deleted; a workbook needs one.

§

DocumentModuleExists

A worksheet can carry only one bound VBA document module.

§

InvalidArgument(String)

The operation was rejected by a lower layer that does not yet report a typed error – currently the Excel Table and pivot internals.

Carries message text only. Do not match on the string; variants will be carved out of this one as those layers are typed, which is why Error is #[non_exhaustive].

§

Xlsx(String)

Reading or writing the .xlsx container failed.

§

Vba(String)

Reading or writing the VBA project failed.

§

VbaSyntax

A VBA module failed to parse.

Carries the position separately from the message so a caller can point at the offending line – an editor integration, or visi macro check --json – without parsing the text back out.

Fields

§message: String

What went wrong, phrased for someone reading it.

§module: Option<String>

The module the error is in, when the caller knew one.

§line: u32

1-based line number within that module’s source.

§column: u32

1-based column number, counted in characters.

§

VbaRuntime

A VBA procedure raised a run-time error.

Carries VBA’s own Err.Number so a caller can compare it against what Excel would have raised, which is what the differential fuzzer does.

Fields

§message: String

Err.Description.

§number: i32

Err.Number.

§

Eval(EngineError)

Formula evaluation failed.

Implementations§

Source§

impl Error

Source

pub fn not_found(kind: ObjectKind, name: impl Into<String>) -> Self

A Error::NotFound with no “did you mean” candidates.

Source

pub fn not_found_among( kind: ObjectKind, name: impl Into<String>, available: Vec<String>, ) -> Self

A Error::NotFound that also carries the names that do exist.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
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, f: &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<EngineError> for Error

Source§

fn from(err: EngineError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Error

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V