Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error { Io { path: PathBuf, message: String, }, Template { template: String, message: String, }, TemplateValidation { template: String, reason: String, }, Config { message: String, }, FileTooLarge { path: PathBuf, size: usize, limit: usize, }, NoFiles { path: PathBuf, }, Serialization { message: String, }, InvalidUtf8 { path: PathBuf, }, SystemTime { message: String, }, Multiple { count: usize, errors: Vec<Error>, }, InvalidPattern { pattern: String, reason: String, }, }
Expand description

Comprehensive error types for the llm-utl library.

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

Io

IO error with context about the file path.

Fields

§path: PathBuf

Path where the error occurred

§message: String

Error message

§

Template

Template rendering error.

Fields

§template: String

Template name

§message: String

Error message

§

TemplateValidation

Template validation error.

Fields

§template: String

Template name or path

§reason: String

Validation failure reason

§

Config

Configuration validation error.

Fields

§message: String

Detailed error message

§

FileTooLarge

File exceeds maximum token limit.

Fields

§path: PathBuf

Path to the oversized file

§size: usize

Actual token count

§limit: usize

Maximum allowed tokens

§

NoFiles

No processable files found in directory.

Fields

§path: PathBuf

Directory that was scanned

§

Serialization

JSON serialization error.

Fields

§message: String

Error message

§

InvalidUtf8

Invalid UTF-8 encountered in file.

Fields

§path: PathBuf

Path to file with encoding issues

§

SystemTime

System time error.

Fields

§message: String

Error message

§

Multiple

Multiple errors occurred during processing.

Fields

§count: usize

Number of errors

§errors: Vec<Error>

Collection of errors

§

InvalidPattern

Invalid output pattern.

Fields

§pattern: String

The invalid pattern

§reason: String

Reason why it’s invalid

Implementations§

Source§

impl Error

Source

pub fn io(path: impl Into<PathBuf>, source: Error) -> Self

Creates an IO error with path context.

Source

pub fn config(message: impl Into<String>) -> Self

Creates a configuration error.

Source

pub fn template(template: impl Into<String>, source: Error) -> Self

Creates a template error.

Source

pub fn template_validation( template: impl Into<String>, reason: impl Into<String>, ) -> Self

Creates a template validation error.

Source

pub fn invalid_utf8(path: impl Into<PathBuf>) -> Self

Creates an invalid UTF-8 error.

Source

pub fn no_files(path: impl Into<PathBuf>) -> Self

Creates a no files error.

Source

pub fn invalid_pattern( pattern: impl Into<String>, reason: impl Into<String>, ) -> Self

Creates an invalid pattern error.

Source

pub fn multiple(errors: Vec<Self>) -> Self

Combines multiple errors into a single error.

Source

pub const fn is_io(&self) -> bool

Returns true if this is an IO error.

Source

pub const fn is_config(&self) -> bool

Returns true if this is a configuration error.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

Returns a duplicate of the value. Read more
1.0.0§

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, __formatter: &mut Formatter<'_>) -> Result

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

impl Error for Error

1.30.0§

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

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

fn description(&self) -> &str

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

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

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

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(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<SystemTimeError> for Error

Source§

fn from(e: SystemTimeError) -> 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§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

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
§

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

§

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

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