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

glyph::Error is not std:error::Error #334

Open
ucarion opened this issue Aug 6, 2017 · 5 comments
Open

glyph::Error is not std:error::Error #334

ucarion opened this issue Aug 6, 2017 · 5 comments

Comments

@ucarion
Copy link

ucarion commented Aug 6, 2017

I noticed this when trying to add error_chain to my project, because the following doesn't compile: (piston_window::Glyphs is gfx_graphics::GlyphCache)

let mut glyphs = Glyphs::new("assets/fonts/FiraSans-Regular.ttf", window.factory.clone())
    .chain_err(|| "Could not create glyphs")?;

The error notes:

   = note: the method `chain_err` exists but the following trait bounds were not satisfied: `piston_window::Error : std::error::Error`

I think this would be fixed if glyph::Error implemented std::error::Error. However, I don't claim to fully understand the situation. Could this implementation be added?

@Enet4
Copy link

Enet4 commented Nov 27, 2017

The C-GOOD-ERR) API guideline from the Rust API guidelines states that "Error types should be meaningful and well-behaved". If an error type does not implement std::error::Error, it will not be usable in other error handling mechanisms and libraries. Also problematic, as a consequence to this, is the fact that it does not implement Debug, thus disabling trivial methods such as unwrap().

@bvssvni
Copy link
Member

bvssvni commented Nov 27, 2017

@bvssvni
Copy link
Member

bvssvni commented Nov 27, 2017

According to https://github.com/PistonDevelopers/gfx_texture/blob/master/src/lib.rs, it seems error types are reexported from Gfx.

@Enet4
Copy link

Enet4 commented Nov 27, 2017

@bvssvni I was looking for the concrete GlyphCache implementation, but the documentation would direct me to a broken link. Thanks! I also found a related issue: gfx-rs/gfx#506

@kvark
Copy link
Member

kvark commented Nov 27, 2017

Head's up! The issue was created before LL transition. If you are to submit a PR (that would be great!), it needs to go towards pre-ll branch (assuming you need it for gfx-0.16 and up). If it's going to be non-breaking, we can port the PR to v0.16 branch and release an update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants