Error

Derive Macro Error 

Source
#[derive(Error)]
{
    // Attributes available to this derive:
    #[error]
    #[display]
    #[no_constructors]
    #[no_debug]
    #[from]
}
Expand description

Derive macro for automatically implementing error traits.

Supports the following attributes:

  • #[error] - Mark the field containing the OhnoCore
  • #[display("...")] - Custom display message with field interpolation
  • #[no_constructors] - Disable automatic constructor generation
  • #[no_debug] - Disable automatic Debug trait implementation
  • #[from(Type1, Type2, ...)] - Generate From implementations for specified types

By default, automatically implements std::fmt::Debug unless #[no_debug] is specified. This means existing code with manual #[derive(Debug, Error)] will have conflicts and should either remove the manual Debug derive or add #[no_debug] to preserve the manual implementation.

See the main ohno crate documentation for detailed usage examples.