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

Improve error types #56

Open
BenLeadbetter opened this issue Aug 19, 2024 · 1 comment
Open

Improve error types #56

BenLeadbetter opened this issue Aug 19, 2024 · 1 comment

Comments

@BenLeadbetter
Copy link

Improve error types

Most Result return values use an i32 (an OSStatus) as their error variant. This is not ideal for a couple of reasons

  • i32 doesn't implement std::error::Error so Result values from core midi aren't compatible with a lot of common error handling patterns (e.g. anyhow)
  • the OS status return value doesn't always imply an error - a zero indicates success. So using this as the error type just feels a little semantically strange.
@BenLeadbetter
Copy link
Author

I would propose a solution where we create a dedicated coremidi::Error type, which has a method to retrieve the OS status code value.

This would likely be a "breaking change", but perhaps this isn't so bad if the crate is still in the 0.*.* phase.

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

1 participant