Skip to content

Let oxide_auth_rocket::OAuthFailure be a #[non_exhaustive] enum #118

Description

@lfxgroove

Project Improvement

Currently oxide_auth_rocket::OAuthFailure is a struct with a private inner field Kind which one can retrieve variants from via the oauth() and web() methods. If you want to roll your own error type (since OAuthFailure is not stable) you have to do some cumbersome matching that feels a bit un-rusty:

if let Some(web_failure) = failure.web() {
    //...
} else if let Some(oauth_failure) = failure.oauth() {
    //...
}

Turning the failure type into a non-exhaustive enum would allow users to match on the enum instead of having to call functions while still allowing the project to add new failure modes.

Other context

It just feels like a more ergonomic interface to use.

Tracking pull request

  • A pull request does not yet exist, I could create it if this seems like a reasonable request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    improvementImprove existing implementation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions