-
Notifications
You must be signed in to change notification settings - Fork 469
Added error handling for unknown ALSA device errors #248
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
Conversation
Instead of taking the easy way out and killing the whole program by panicking, device enumeration and stream creation will now report the error variant 'Unknown'
|
LGTM I was playing with something like this myself in #223 (comment) |
|
I'm just going to take this opportunity to moan about the awful error reporting in alsa, and C libs in general. They give you nothing to work with but a meaningless posix error code. |
|
@derekdreery I really like your idea to get the error message directly from alsa. That should enable more differentiated error handling so that if you get some weird error, at least you get somewhat of an idea what went wrong. That beeing written, let me add some rant as well: |
|
@RoflCopter24 I agree with you that panicking is often the wrong thing to do for stable libraries, but all libraries started out as prototypes, and when you're prototyping you don't want to spend ages on errors. It just needs someone to improve error handling here, which anyone can do I think. |
|
What is holding this Pull Request back? |
|
Personally, I think this should be merged, as it is an improvement on the current state of things. |
|
@tomaka Can you comment? |
mitchmindtree
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
While I'm not sure how to feel about the current approach to cross-platform errors in CPAL generally, I agree this at least follows suit with the existing implementation and is nicer than panicking internally.
Instead of taking the easy way out and killing the whole program by panicking, device enumeration and stream creation will now report the error variant 'Unknown' as suggested in #216
Also added an "InvalidArgument" variant for the infamous -22 error (this should resolve #247 and make #206 more handable)