feat(error): add more intuitive CellPos formatting and get rid of ErrorCell

This commit is contained in:
2025-10-10 01:27:05 +04:00
parent 191ec36fef
commit 7bac48f8fc
3 changed files with 30 additions and 26 deletions

View File

@@ -1,21 +1,5 @@
use derive_more::{Display, Error, From};
use crate::parser::worksheet::CellPos;
#[derive(Clone, Debug, Display, Error)]
#[display("'{data}' at {pos}")]
pub struct ErrorCell {
pub pos: CellPos,
pub data: String,
}
impl ErrorCell {
pub fn new(row: u32, column: u32, data: &str) -> Self {
Self {
pos: CellPos { row, column },
data: data.to_string(),
}
}
}
use derive_more::{Display, Error, From};
#[derive(Debug, Display, Error, From)]
pub enum Error {
@@ -28,8 +12,8 @@ pub enum Error {
#[display("There is no data on work sheet boundaries.")]
UnknownWorkSheetRange,
#[display("Failed to read lesson start and end from {_0}.")]
NoLessonBoundaries(ErrorCell),
#[display("Failed to read lesson start and end of lesson at {_0}.")]
NoLessonBoundaries(CellPos),
#[display("No start and end times matching the lesson (at {_0}) was found.")]
LessonTimeNotFound(CellPos),