Remove min by shift type boundaries, improve logging, add more tests, add logs in tests, move fixtures in separate file, move restrictions_violated logic into valid_residents of next slot
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use std::io;
|
||||
|
||||
use log::Level;
|
||||
use serde::Serialize;
|
||||
use thiserror::Error;
|
||||
|
||||
@@ -18,6 +19,16 @@ pub enum SearchError {
|
||||
NoSolutionFound,
|
||||
}
|
||||
|
||||
impl SearchError {
|
||||
pub fn log_level(&self) -> Level {
|
||||
match self {
|
||||
SearchError::SolutionFound | SearchError::ScheduleFull => Level::Info,
|
||||
SearchError::NoSolutionFound => Level::Warn,
|
||||
SearchError::Timeout | SearchError::Config(_) => Level::Error,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<anyhow::Error> for SearchError {
|
||||
fn from(err: anyhow::Error) -> Self {
|
||||
SearchError::Config(err.to_string())
|
||||
|
||||
Reference in New Issue
Block a user