Print dates in a nicer format
This commit is contained in:
parent
531a140c45
commit
3e70b2e2c9
5 changed files with 67 additions and 5 deletions
|
|
@ -4,9 +4,10 @@ use chrono::NaiveDate;
|
|||
|
||||
use crate::files::primitives::{Span, Time};
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum Error {
|
||||
/// A delta step resulted in an invalid date.
|
||||
#[error("delta step resulted in invalid date")]
|
||||
DeltaInvalidStep {
|
||||
span: Span,
|
||||
start: NaiveDate,
|
||||
|
|
@ -15,6 +16,7 @@ pub enum Error {
|
|||
prev_time: Option<Time>,
|
||||
},
|
||||
/// A time-based delta step was applied to a date without time.
|
||||
#[error("time-based delta step applied to date without time")]
|
||||
DeltaNoTime {
|
||||
span: Span,
|
||||
start: NaiveDate,
|
||||
|
|
@ -23,6 +25,7 @@ pub enum Error {
|
|||
/// A `DATE`'s repeat delta did not move the date forwards in time. Instead,
|
||||
/// it either remained at the current date (`to == from`) or moved backwards
|
||||
/// in time (`to < from`).
|
||||
#[error("repeat delta did not move forwards")]
|
||||
RepeatDidNotMoveForwards {
|
||||
span: Span,
|
||||
from: NaiveDate,
|
||||
|
|
@ -30,12 +33,16 @@ pub enum Error {
|
|||
},
|
||||
/// A `MOVE a TO b` statement was executed, but there was no entry at the
|
||||
/// date `a`.
|
||||
#[error("tried to move nonexisting entry")]
|
||||
MoveWithoutSource { span: Span },
|
||||
/// A division by zero has occurred.
|
||||
#[error("tried to divide by zero")]
|
||||
DivByZero { span: Span, date: NaiveDate },
|
||||
/// A modulo operation by zero has occurred.
|
||||
#[error("tried to modulo by zero")]
|
||||
ModByZero { span: Span, date: NaiveDate },
|
||||
/// Easter calculation failed.
|
||||
#[error("easter calculation failed")]
|
||||
Easter {
|
||||
span: Span,
|
||||
date: NaiveDate,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue