Skip to content

gh browse -n -R should error on 404 #7255

Description

@ianwilliams1

Describe the bug

If a target repo does not exist, eg: gh browse -R cli/cli brings up a 404 in the browser, but gh browse -n -R cli/cli returns a destination URL that does not exist and exit status 0.

Steps to reproduce the behavior

$  gh browse -n -R cli/cli
https://github.com/cli/cli

$ echo $?
0

$  gh browse -n -R cli/cli-doesnotexist
https://github.com/cli/cli-doesnotexist

$ echo $?
0

Expected vs actual behavior

Expect to test if the constructed destination URL exist before displaying to the user, or at least provide a warning that it's not reachable.
gh browse -n -R ORG/REPO where ORG/REPO does not exist should return error message and non-zero exit code

Maybe 2 error codes - one if ORG reachable but REPO is not, one for ORG/REPO not reachable?

Logs

See steps to reproduce

Activity

  1. changed the title [-]`gh browse -n -R` does error on 404[/-] [+]`gh browse -n -R` should error on 404[/+] on Mar 30, 2023
  2. added
    priority-3Affects a small number of users or is largely cosmetic
    and removed on Mar 30, 2023
  3. vilmibm commented on Mar 30, 2023

    @vilmibm
    Contributor

    I'm fine with a check to ensure that the repo we're about to open a page for actually exists. It means a network call when there previously wasn't one but i think that's acceptable.

    To keep it simple, just a single non-zero error code for owner/repo not existing is sufficient for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions