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
I'm not quite happy with the current error handling.
There's one MagicError enum for aynthing that can go wrong in the crate and one opaque FfiError for anything that can go wrong when calling libmagic.
I think each function should return a specific error enum that only has the cases that can go wrong in that particular function.
For API stability, maybe the cases should currently not expose more than std:error::Error. LibmagicError::ApiViolation should rather be an assertion. There's not much the user can do in that case and it might even be unsafe to keep using libmagic in that case.
For user convenvience, maybe the one magic "whatever" type should be available to convert into.
thiserror is pretty conventient for development, but adds to dependencies and compile time. Maybe it could be replaced with cargo expand code once the dust has settled.
The text was updated successfully, but these errors were encountered:
I'm not quite happy with the current error handling.
There's one
MagicError
enum for aynthing that can go wrong in the crate and one opaqueFfiError
for anything that can go wrong when callinglibmagic
.I think each function should return a specific error enum that only has the cases that can go wrong in that particular function.
For API stability, maybe the cases should currently not expose more than
std:error::Error
.LibmagicError::ApiViolation
should rather be an assertion. There's not much the user can do in that case and it might even be unsafe to keep usinglibmagic
in that case.Some references:
For user convenvience, maybe the one
magic
"whatever" type should be available to convert into.thiserror
is pretty conventient for development, but adds to dependencies and compile time. Maybe it could be replaced withcargo expand
code once the dust has settled.The text was updated successfully, but these errors were encountered: