piston_window
piston_window copied to clipboard
Inconsistent error handling
The WindowSettings builder returns a String as its error type, while the Glyphs constructor produces an Error. I think it'd be nice to change the WindowSettings builder error from String to another variant on the Error enum (I quite like being able to see all the possible run-time errors for a library listed as variants of a single enum, and this follows how std::io describes its errors). It might be best to change the error upstream first.
The reason it uses String is because of https://github.com/PistonDevelopers/piston/blob/master/src/window/src/lib.rs#L39-L43.
There is no finite amount of possible variants, as they are controlled by the window backend. An enum can't be used here.
Ah yes, I see the issue there. I think it'd still be nice to encapsulate this in a variant for piston_window's Error enum so that it's a little clearer where the error is coming from, i.e.
pub enum Error {
Texture(TextureError),
Freetype(Error),
WindowBuilding(String),
}