You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the internal macro that converts low-level C library error codes to an user-facing Result just passes through error codes returned by C functions, which users can compare with some crate constants to know the precise error cause:
While this works fine in most cases, it's not an ideal design for several reasons:
In theory, the same error code may be used by different C libraries to represent different error causes. Moreover, users can't know which library the error code belongs to, as that information is not meant to be made available on the error struct.
A set of error causes is more idiomatically represented in Rust by an enum type, rather than a raw integer.
Therefore, a welcome improvement would be replacing the error_code field with a error_cause field, which relates the library that caused the error with its actual cause. This would complicate the error handling logic significantly, but I think it's worth it for end usage.
The text was updated successfully, but these errors were encountered:
Currently, the internal macro that converts low-level C library error codes to an user-facing
Result
just passes through error codes returned by C functions, which users can compare with some crate constants to know the precise error cause:vorbis-rs/packages/vorbis_rs/src/common/error.rs
Lines 53 to 65 in 5aa7160
While this works fine in most cases, it's not an ideal design for several reasons:
Therefore, a welcome improvement would be replacing the
error_code
field with aerror_cause
field, which relates the library that caused the error with its actual cause. This would complicate the error handling logic significantly, but I think it's worth it for end usage.The text was updated successfully, but these errors were encountered: