Confy panics when loading a configuration file with missing fields
Closed this issue · 2 comments
yuvallanger commented
The unwrap
call unwrapping toml::from_str
's output in line 105 of /src/lib.rs
(currently in master 7115b65 and 0.3.1 95b1aac) does that:
Ok(mut cfg) => Ok(toml::from_str(&cfg.get_string().unwrap()).unwrap()),
Will it be reasonable to create an enum ConfyError { BadTomlData }
so I could return it in the load function at the point of toml::from_str
's failure?
It would change load's type signature into a more general one or a totally different one if we return both IoError
s and ConfyError
as Error
trait values, I am not sure, so it might not be a good idea.
yuvallanger commented
Maybe replace all unwrap
s with context specific ConfyError
?
Dylan-DPC-zz commented
This is resolved by #12. We don't have any unwraps left in the code (🎉) so closing this. Thanks