-
Notifications
You must be signed in to change notification settings - Fork 186
Description
There are several functions that can panic where it makes more sense to return a Option/Result. display_size() on windows/linux is an example. On Linux, it panics if it can't open the display or get the default screen. It could easily return an Option<(u64, u64)>, or even Result<(u64, u64), rdev::ToBeDeterminedError>.
The ToBeDeterminedError type is so named because I'm not fully sure of it's requirements yet. I think we should use one Error type across the entire crate, so that every fallible operation returns Result<T, ToBeDeterminedError> for some type T (we could make rdev::Result<T> a type alias for this, as std::io::Result does). ToBeDeterminedError should be platform agnostic - no X11NoDisplay errors, only NoDisplay errors. For example, it would include all variants of SimulateError, ListenError and NoDisplay error, and maybe some more later. It would also probably be marked with the #[non_exhaustive] attribute until rdev has a 1.0 release. How does this sound?