coremidi
coremidi copied to clipboard
Improve error types
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
i32doesn't implementstd::error::ErrorsoResultvalues 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.
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.