Skip to content

Defer error codes to a field in derive macro #457

@cptpiepmatz

Description

@cptpiepmatz

I like doing custom errors with a kind field (usually an enum) to describe the exact type of error, kinda like std::io::Error with its ErrorKind. For labels and help, it's easy to just refer to that field. But from what I see in the docs, there's no way to do the same for code when using the derive macro. Would be nice if that worked, right now I have to implement Diagnostic manually just because of that.

I'm up for adding support for it myself, just need to know what the preferred syntax would be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions