Error when moving untimed entry to new time

This commit is contained in:
Joscha 2021-12-21 19:33:55 +01:00
parent 1ac39c69f2
commit 73a44a697a
4 changed files with 18 additions and 4 deletions

View file

@ -48,6 +48,10 @@ pub enum Error {
/// date `a`.
#[error("tried to move nonexisting entry")]
MoveWithoutSource { index: usize, span: Span },
/// A `MOVE a TO b` statement was executed where `b` contains a time but `a`
/// doesn't was executed.
#[error("tried to move un-timed entry to new time")]
TimedMoveWithoutTime { index: usize, span: Span },
/// A division by zero has occurred.
#[error("tried to divide by zero")]
DivByZero {
@ -162,6 +166,10 @@ impl Error {
let msg = "Tried to move nonexisting entry".to_string();
Self::print_at(sources, index, span, msg);
}
Error::TimedMoveWithoutTime { index, span } => {
let msg = "Tried to move un-timed entry to new time".to_string();
Self::print_at(sources, index, span, msg);
}
Error::DivByZero { index, span, date } => {
let msg = format!(
"Tried to divide by zero\