Skip to main content

Error

Enum Error 

Source
pub enum Error {
Show 62 variants RecordsOffMustNotContainOffsetPeriod { offset_period: String, }, StartPeriodAfterEndPeriod { start: String, end: String, }, InvalidPeriod { bad_value: String, }, PeriodIsNotYearAndMonth, PeriodIsNotYearMonthAndFortnight, InvalidGranularityForTimeOff { free_granularity: Granularity, service_fees_granularity: Granularity, }, GranularityTooCoarse { granularity: Granularity, max_granularity: Granularity, target_period: String, }, CannotInvoiceForMonthWhenCadenceIsBiWeekly, CannotExpenseForMonthWhenCadenceIsBiWeekly, CannotExpenseForFortnightWhenCadenceIsMonthly, PasswordDoesNotMatch, EmailPasswordTooShort { min_length: usize, actual_length: usize, }, EmailAtomTemplateError { underlying: String, }, InvalidEmailAddress { role: String, underlying: String, }, InvalidNameForEmail { role: String, underlying: String, }, InvalidPasswordForEmail { purpose: String, underlying: String, }, RecipientAddressesCannotBeEmpty, InvalidSmtpServer { underlying: String, }, InvalidUtf8, AESDecryptionFailed, InvalidAESBytesTooShort { expected_at_least: usize, found: usize, }, CreateSmtpTransportError { underlying: String, }, CreateEmailError { underlying: String, }, AddAttachmentsError { underlying: String, }, SendEmailError { underlying: String, }, InvalidDecimalToF64Conversion { value: String, }, InvalidDecimalFromF64Conversion { value: f64, }, FailedToLoadFont { family_name: String, }, InvalidF64String { bad_value: String, reason: String, }, FailedToWriteDataToDisk { underlying: String, }, FailedToRonSerializeData { type_name: String, underlying: String, }, InvalidCompanyInformation { reason: String, }, InvalidInvoiceNumberString { invalid_string: String, }, InvalidInvoiceInfo { reason: String, }, InvalidPaymentInfo { reason: String, }, InvalidServiceFees { reason: String, }, OffsetPeriodMustNotBeInRecordOfPeriodsOff { offset_period: String, period_kind: String, }, SpecifiedOutputPathDoesNotExist { path: String, }, FailedToCreateOutputDirectory { underlying: String, }, TargetPeriodMustHaveExpenses { target_period: String, }, FailedToParseYear { invalid_string: String, }, FileNotFound { path: String, underlying: String, }, Deserialize { type_name: String, error: String, }, InvalidDayFromString { invalid_string: String, reason: String, }, InvalidYearAndMonth { underlying: String, }, InvalidDate { underlying: String, }, InvalidDay { day: i32, reason: String, }, InvalidMonth { month: i32, reason: String, }, FailedToParseMonth { invalid_string: String, }, InvalidExpenseItem { invalid_string: String, reason: String, }, TargetPeriodMustNotBeInRecordOfPeriodsOff { target_period: String, }, FailedToParsePaymentTermsNetDays { invalid_string: String, }, L18nNotFound { language: Language, }, InvalidHexColor { invalid_string: String, }, FailedToParseDate { underlying: String, }, FoundNoExchangeRate { target: Currency, base: Currency, }, LoadSource { underlying: String, }, BuildPdf { underlying: String, }, ExportDocumentToPdf { underlying: String, }, SavePdf { underlying: String, }, NetworkError { underlying: String, }, ParseError { underlying: String, },
}
Expand description

Error type for the logic crate, encapsulating various errors that can occur during PDF generation and manipulation.

Variants§

§

RecordsOffMustNotContainOffsetPeriod

The offset period must not be in the record of periods off.

Fields

§offset_period: String
§

StartPeriodAfterEndPeriod

The start period is after the end period.

Fields

§start: String
§

InvalidPeriod

Not a valid YearAndMonth nor YearMonthAndFortnight

Fields

§bad_value: String
§

PeriodIsNotYearAndMonth

Period is not YearAndMonth

§

PeriodIsNotYearMonthAndFortnight

Period is not YearMonthAndFortnight

§

InvalidGranularityForTimeOff

Fields

§free_granularity: Granularity
§service_fees_granularity: Granularity
§

GranularityTooCoarse

Granularity too coarse,

Fields

§granularity: Granularity
§max_granularity: Granularity
§target_period: String
§

CannotInvoiceForMonthWhenCadenceIsBiWeekly

Cannot invoice for month when cadence is bi-weekly.

§

CannotExpenseForMonthWhenCadenceIsBiWeekly

Cannot expense for month when cadence is bi-weekly

§

CannotExpenseForFortnightWhenCadenceIsMonthly

Cannot expense for fortnight when cadence is monthly.

§

PasswordDoesNotMatch

Password does not match, e.g. when the user tries to set a password and the confirmation password does not match.

§

EmailPasswordTooShort

Email password is too short.

Fields

§min_length: usize

The minimum length of the email password.

§actual_length: usize

The actual length of the email password.

§

EmailAtomTemplateError

Failed to parse the email atom template, e.g. when the template is not valid.

Fields

§underlying: String
§

InvalidEmailAddress

Invalid email address

Fields

§role: String
§underlying: String
§

InvalidNameForEmail

Invalid name for email

Fields

§role: String
§underlying: String
§

InvalidPasswordForEmail

Fields

§purpose: String
§underlying: String
§

RecipientAddressesCannotBeEmpty

Recipient addresses cannot be empty.

§

InvalidSmtpServer

Failed to parse SMTP Server

Fields

§underlying: String
§

InvalidUtf8

Failed to parse a string into a valid UTF-8 string.

§

AESDecryptionFailed

Failed to decrypt data with AES.

§

InvalidAESBytesTooShort

Invalid AES bytes, e.g. when the length is not as expected.

Fields

§expected_at_least: usize
§found: usize
§

CreateSmtpTransportError

Failed to create SMTP transport, e.g. when the SMTP server is not reachable.

Fields

§underlying: String
§

CreateEmailError

Failed to create Lettre Email from Email struct.

Fields

§underlying: String
§

AddAttachmentsError

Failed to add attachments to the email, e.g. when the file is not found or cannot be read.

Fields

§underlying: String

Underlying error when adding attachments to the email.

§

SendEmailError

Failed to send email

Fields

§underlying: String
§

InvalidDecimalToF64Conversion

Failed to convert to f64 from a Decimal

Fields

§value: String
§

InvalidDecimalFromF64Conversion

Failed to convert f64 value to a Decimal

Fields

§value: f64
§

FailedToLoadFont

Failed to load a font, e.g. when the font file is not found or cannot be read.

Fields

§family_name: String
§

InvalidF64String

Failed to parse a string into an Decimal, e.g. when the string is not a valid number.

Fields

§bad_value: String
§reason: String
§

FailedToWriteDataToDisk

Failed to write data to disk, e.g. when the file system is not accessible.

Fields

§underlying: String
§

FailedToRonSerializeData

Failed to serialize data to RON format.

Fields

§type_name: String
§underlying: String
§

InvalidCompanyInformation

Error while building CompanyInformation from Terminal UI input.

Fields

§reason: String
§

InvalidInvoiceNumberString

Failed to parse invoice number from a string, e.g. when the format is incorrect.

Fields

§invalid_string: String
§

InvalidInvoiceInfo

Error while building InvoiceInfo from Terminal UI input.

Fields

§reason: String
§

InvalidPaymentInfo

Error while building PaymentInfo from Terminal UI input.

Fields

§reason: String
§

InvalidServiceFees

Error while building ServiceFees from Terminal UI input.

Fields

§reason: String
§

OffsetPeriodMustNotBeInRecordOfPeriodsOff

The offset period must not be in the record of periods off.

Fields

§offset_period: String
§period_kind: String
§

SpecifiedOutputPathDoesNotExist

The manually specified output path does not exist.

Fields

§path: String
§

FailedToCreateOutputDirectory

Failed to create the output directory for the PDF file.

Fields

§underlying: String
§

TargetPeriodMustHaveExpenses

Target period must have expenses, but it does not.

Fields

§target_period: String
§

FailedToParseYear

Failed to parse year

Fields

§invalid_string: String
§

FileNotFound

Failed to load file

Fields

§path: String
§underlying: String
§

Deserialize

Failed to deserialize a type

Fields

§type_name: String
§error: String
§

InvalidDayFromString

Failed to parse Day from String

Fields

§invalid_string: String
§reason: String
§

InvalidYearAndMonth

Invalid YearAndMonth

Fields

§underlying: String
§

InvalidDate

Invalid date

Fields

§underlying: String
§

InvalidDay

Invalid day of the month, e.g. when the day is not between 1 and 31.

Fields

§day: i32
§reason: String
§

InvalidMonth

Invalid month, e.g. when the month is not between 1 and 12.

Fields

§month: i32
§reason: String
§

FailedToParseMonth

Failed to parse Month from String

Fields

§invalid_string: String
§

InvalidExpenseItem

Failed to parse expense item from a string, e.g. when the format is incorrect.

Fields

§invalid_string: String
§reason: String
§

TargetPeriodMustNotBeInRecordOfPeriodsOff

The target period is in the record of periods off, but it must not be.

Fields

§target_period: String
§

FailedToParsePaymentTermsNetDays

Failed to parse PaymentTerms NetDays from a string, e.g. when the format is incorrect.

Fields

§invalid_string: String
§

L18nNotFound

Failed to find the localization file for a specific language.

Fields

§language: Language

The language that was not found, e.g. “EN” for English.

§

InvalidHexColor

Failed to parse a string into a Hexcolor

Fields

§invalid_string: String
§

FailedToParseDate

Failed to parse a date, e.g. when the format is incorrect or the date is invalid.

Fields

§underlying: String
§

FoundNoExchangeRate

Error converting between currencies, e.g. when the exchange rate is not found.

Fields

§target: Currency

The target currency for the exchange rate, e.g. “EUR”.

§base: Currency

The base currency for the exchange rate, e.g. “USD”.

§

LoadSource

Error when loading a resource for typst.

Fields

§underlying: String
§

BuildPdf

Error when compiling Typst source to a PagedDocument.

Fields

§underlying: String
§

ExportDocumentToPdf

Error when exporting a PagedDocument to PDF.

Fields

§underlying: String
§

SavePdf

Error when saving the PDF to a file.

Fields

§underlying: String
§

NetworkError

Error when fetching exchange rates from an API.

Fields

§underlying: String
§

ParseError

Error when parsing the response from the exchange rate API.

Fields

§underlying: String

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

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

impl Error for Error

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

Source§

fn len(&self) -> usize

The number of items that this chain link consists of.
Source§

fn append_to(self, v: &mut Vec<T>)

Append the elements in this link to the chain.
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> Container<T> for T
where T: Clone,

Source§

type Iter = Once<T>

An iterator over the items within this container, by value.
Source§

fn get_iter(&self) -> <T as Container<T>>::Iter

Iterate over the elements of the container (using internal iteration because GATs are unstable).
Source§

impl<T> ErasedDestructor for T
where T: 'static,

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> OrderedContainer<T> for T
where T: Clone,

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be 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§

fn to_string(&self) -> String

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

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

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

Source§

type Error = !

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

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