Uploaded image for project: 'Skara'
  1. Skara
  2. SKARA-2059

Improve error message when cli encounters 401

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.0
    • None
    • cli
    • None

      A user tried to run `git pr checkout` and got UncheckedRestException with 401. The repository in question had remotes pointing to a gitlab instance while the user was trying to get a PR from github. Not sure if that is relevant here. We should not fail with a stacktrace but should rather explain that we authorization failed and print which URL we tried to connect to.

      Full stacktrace:
      Exception in thread “main” org.openjdk.skara.network.UncheckedRestException: [401] Request returned bad status
      at org.openjdk.skara.network/org.openjdk.skara.network.RestRequest.executeUnparsed(RestRequest.java:534)
      at org.openjdk.skara.network/org.openjdk.skara.network.RestRequest$QueryBuilder.executeUnparsed(RestRequest.java:224)
      at org.openjdk.skara.forge/org.openjdk.skara.forge.gitlab.GitLabHost.isValid(GitLabHost.java:97)
      at org.openjdk.skara.forge/org.openjdk.skara.forge.Forge.from(Forge.java:108)
      at org.openjdk.skara.forge/org.openjdk.skara.forge.Forge.from(Forge.java:116)
      at org.openjdk.skara.cli/org.openjdk.skara.cli.ForgeUtils.from(ForgeUtils.java:159)
      at org.openjdk.skara.cli/org.openjdk.skara.cli.ForgeUtils.getForge(ForgeUtils.java:176)
      at org.openjdk.skara.cli/org.openjdk.skara.cli.pr.Utils.getForge(Utils.java:374)
      at org.openjdk.skara.cli/org.openjdk.skara.cli.pr.GitPrCheckout.main(GitPrCheckout.java:79)
      at org.openjdk.skara.args/org.openjdk.skara.args.Command.main(Command.java:54)
      at org.openjdk.skara.args/org.openjdk.skara.args.MultiCommandParser.lambda$parse$2(MultiCommandParser.java:65)
      at org.openjdk.skara.cli/org.openjdk.skara.cli.GitPr.main(GitPr.java:111)
      at org.openjdk.skara.cli/org.openjdk.skara.cli.GitSkara.main(GitSkara.java:231)

            zsong Zhao Song
            erikj Erik Joelsson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: