fix: more checks for config
This commit is contained in:
parent
5c1c181620
commit
d351555e35
1 changed files with 14 additions and 0 deletions
14
src/lib.rs
14
src/lib.rs
|
@ -222,6 +222,20 @@ impl Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.sunset_start >= config.sunset_end {
|
||||||
|
return Err(ConfigError::InvalidTime(format!(
|
||||||
|
"sunset_start ({0}) is greater than sunset_end ({1})",
|
||||||
|
config.sunset_start, config.sunset_end
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if config.sunrise_start >= config.sunrise_end {
|
||||||
|
return Err(ConfigError::InvalidTime(format!(
|
||||||
|
"sunrise_start ({0}) is greater than sunrise_end ({1})",
|
||||||
|
config.sunrise_start, config.sunrise_end
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
Ok(config)
|
Ok(config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue