Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-33306

Stack trace printed when repo:status privilege missing

XMLWordPrintable

      If you build a pull request yet your scan credentials lack the notifications privilege, you get an ugly stack trace along the lines of

      ERROR: Could not update commit status
      java.io.FileNotFoundException: {"message":"Not Found","documentation_url":"..."}
      	at org.kohsuke.github.Requester.handleApiError(Requester.java:527)
      	at org.kohsuke.github.Requester._to(Requester.java:257)
      	at org.kohsuke.github.Requester.to(Requester.java:203)
      	at org.kohsuke.github.GHRepository.createCommitStatus(GHRepository.java:854)
      	at org.jenkinsci.plugins.github_branch_source.GitHubBuildStatusNotification.createCommitStatus(GitHubBuildStatusNotification.java:78)
      	at ...
      Caused by: java.io.FileNotFoundException: .../api/v3/repos/.../.../statuses/...
      	at ...
      	at org.kohsuke.github.Requester.parse(Requester.java:483)
      	at org.kohsuke.github.Requester._to(Requester.java:236)
      ... 17 more
      Caused by: java.io.FileNotFoundException: ...
      	at ...
      	at org.kohsuke.github.Requester.parse(Requester.java:479)
      ... 18 more
      

      Since this is a fairly predictable user error (or the user might even have just decided to deny this permission), it would be more appropriate to catch FileNotFoundException here and print a one-line warning to the build log saying that the commit status notification could not be sent, and leave it at that. (For diagnostic purposes the full exception could be logged at FINE.)

            recena Manuel Recena Soto
            jglick Jesse Glick
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: