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
Seeing if I can replace thiserror with derive_more:
use derive_more::{Display,Error};#[derive(Debug,Display,Error)]enumError{SomeError,// ...}
gives a compilation error (Error is defined twice), whereas thiserror has no problem with the same:
use thiserror::Error;#[derive(Debug,Error)]enumError{SomeError,// ...}
compiles fine.
The text was updated successfully, but these errors were encountered:
U007D
changed the title
derive_more::Error macro collides with local Error enum, unlike thiserror.derive_more::Error macro collides with local Error enum, whereas thiserror is fine.
Aug 27, 2024
It turned out that the case for defining pub struct Error/pub enum Error/pub type Error is very often one. We had tons of such errors in granular modules (like transcoding::Error, command::create_user::Error, etc), and, as the result, the tons of conflicts with use derive_more::Error imports. This lead to a quite refactoring, where in most cases such error types were renamed more precisely, depending on use-case. However, there are still enough places where such renaming is inappropriate or undesired, so we were forced to use use derive_more::Error as StdError imports there, which turned out to be a good practice, though, as it removed any ambiguities regarding [`Error`] references in docs.
I would advocate leaving this as a decision for the user (rather than requiring renaming), but you've clearly considered this and made a call. Thank you for this information.
EDIT: I just read #405 and see you're already thinking about this as well.
Seeing if I can replace
thiserror
withderive_more
:gives a compilation error (
Error
is defined twice), whereasthiserror
has no problem with the same:compiles fine.
The text was updated successfully, but these errors were encountered: