ExPixel / miniaudio-rs

Rust bindings for miniaudio C library.
https://crates.io/crates/miniaudio
MIT License
49 stars 20 forks source link

miniaudio::Error doesn't implement std::error::Error - is this on purpose? #49

Closed ohmree closed 3 years ago

ohmree commented 3 years ago

Currently miniaudio::Error doesn't implement std::error::Error.
This makes it hard to work with crates like anyhow and its fork eyre. Instead of a single question mark operator that bubbles up the error I need to either use expect which only works the same inside main, find the right combination of map_err and eyre!/anyhow! (which is verbose and not very DRY) or manually handle errors with if let/match + return which is arguably worse.

Is there any particular reason for this? If not I think I could try whipping up a PR sometime soon, potentially using thiserror if it works well with the integer-based error representation miniaudio uses.

ExPixel commented 3 years ago

No. It's an oversight on my part for sure. The miniaudio API is looking like it's stabilizing so it's probably time to start making changes again, though.