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

feat: use anyhow #25

Merged
merged 1 commit into from
Feb 10, 2024
Merged

feat: use anyhow #25

merged 1 commit into from
Feb 10, 2024

Conversation

Odilf
Copy link
Contributor

@Odilf Odilf commented Feb 7, 2024

Closes #24

Change the hand rolled Box<dyn Error> approach for error handling to simply using anyhow.

This is a breaking change if someone uses errors. However, the migration should be fairly straightforward:

  1. Change ffmpeg_sidecar::error::Result to anyhow::Result
  2. Change ffmpeg_sidecar::error::Error to anyhow::Error

If someone is using Error directly (i.e., getting the message or the source) then they should consult the anyhow docs to find the equivalent functionality for their use case.

@nathanbabcock
Copy link
Owner

Great job with this PR. CI passes, all examples work, and the code changes are minimal.

I also appreciate how utilities in anyhow make the source code cleaner, things like anyhow::bail!(...) instead of return Err(Error::msg(...)), and .context(...) instead of .ok_or_else(|| ...).

I will merge this and plan to publish a release on Cargo next week. Since this is technically a (small) breaking change, I'll bump the major version number. Coincidentally, next week will be one year since the first released version, v0.1 in Feb 2023.

@nathanbabcock nathanbabcock merged commit c4802b7 into nathanbabcock:main Feb 10, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

Consider adding anyhow as a dependency
2 participants