Skip to content

Conversation

@cango91
Copy link

@cango91 cango91 commented Jul 4, 2025

Summary

This PR migrates the error handling from the deprecated failure crate to thiserror, which is the modern standard for error handling in Rust.

Changes

  • Cargo.toml: Updated both dependencies and build-dependencies to replace failure = "0.1.6" with thiserror = "2.0.12"
  • src/error.rs:
    • Replaced use failure::Fail with use thiserror::Error
    • Updated derive macro from #[derive(Clone, Debug, Fail)] to #[derive(Clone, Debug, Error)]
    • Converted all error attribute syntax from #[fail(display = "...")] to #[error("...")]

Rationale

The failure crate has been officially deprecated and is no longer maintained. The Rust community has standardized on thiserror for error handling, which provides:

  • Better compile-time error checking
  • More efficient error types
  • Active maintenance and support
  • Better integration with the modern Rust ecosystem

Impact

  • No breaking changes: The public API remains identical
  • Performance: Potential minor performance improvements due to more efficient error types
  • Maintenance: Ensures continued compatibility with future Rust versions
  • Dependencies: Reduces dependency on unmaintained crates

Testing

  • All existing tests continue to pass
  • Error message formatting remains unchanged
  • API compatibility is preserved

This migration ensures the library stays up-to-date with modern Rust best practices and maintains long-term viability.

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.

1 participant