Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent error handling #107

Open
mitchmindtree opened this issue Dec 19, 2015 · 2 comments
Open

Inconsistent error handling #107

mitchmindtree opened this issue Dec 19, 2015 · 2 comments

Comments

@mitchmindtree
Copy link
Member

@mitchmindtree mitchmindtree commented Dec 19, 2015

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.

@bvssvni

This comment has been minimized.

Copy link
Member

@bvssvni bvssvni commented Dec 20, 2015

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.

@mitchmindtree

This comment has been minimized.

Copy link
Member Author

@mitchmindtree mitchmindtree commented Dec 20, 2015

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),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.