mirror of
https://github.com/n08i40k/schedule-parser-rusted.git
synced 2025-12-06 17:57:47 +03:00
feat(error): add more intuitive CellPos formatting and get rid of ErrorCell
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user