Skip to content

Cryptic error message if GitHub token is incorrect #23

@starsep

Description

@starsep

If you have leading/trailing space in token in config.toml (error in copy-pasting) i.e.

[github]
token = " TOKEN_HERE"

gitout

  • will be able to get repositories information including private ones
  • will crash when trying to clone first private repository it tries with cryptic error:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: -1, klass: 34, message: "too many redirects or authentication replays" }', src/libcore/result.rs:1188:5

If token is incorrect in the other way then gitout crashes when trying to get repos info with

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /usr/src/rustc-1.41.0/src/libcore/macros/mod.rs:15:40

More helpful error message would be appreciated.
My api token is 40 hex characters.
I am not sure whether one could assert token format as there are probably no long-term guarantees in GitHub API.
I would assume there should be some endpoint which allows for easy checking whether provided token is correct. I checked that https://stackoverflow.com/a/58572011 seems to ignore extra spaces, haven't tried GraphQL API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpr welcomeOpen for external contribution

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions