stalwartlabs / mail-send

E-mail delivery library for Rust with DKIM support
https://docs.rs/mail-send/
Apache License 2.0
209 stars 21 forks source link

Add an `impl std::error::Error` for `mail_send::Error` #11

Closed LeoniePhiline closed 1 year ago

LeoniePhiline commented 1 year ago

Hello!

I've been using thiserror and stumbled upon this when trying to integrate mail_send:

mail_send::Error (and also mail_auth::Error) do not implement the std::error::Error trait. That's why they cannot be simply integrated into other error-frameworks which all build on the std lib's Error trait.

mail_send and mail_auth could also opt into using the thiserror crate. thiserror::Error is entirely transparent to the library user, and takes some boilerplate away from you.

Here's how this could look like: https://github.com/jolimail/mrml-core/pull/38/files#diff-c08afca406e15cd665ef6c443014a8472bb79435231a21463239333886aed304

A pure std::error::Error implementation, without #[derive(thiserror::Error)] might look like this: https://docs.rs/askama_shared/0.12.2/src/askama_shared/error.rs.html#43-54

mdecimus commented 1 year ago

Please check the latest commit, now Error implements std::error::Error.

LeoniePhiline commented 1 year ago

Thanks so much!

Are you planning a minor / patch version release any time soon?

mdecimus commented 1 year ago

Just published version 0.3.2 on crates.io!

LeoniePhiline commented 1 year ago

Thank you! :) Also thank you for open sourcing your work! I wish you the best of luck for your company!