Skip to content

Add custom error handler for missing default branch#2988

Merged
koesie10 merged 1 commit intomainfrom
koesie10/error-default-branch
Oct 18, 2023
Merged

Add custom error handler for missing default branch#2988
koesie10 merged 1 commit intomainfrom
koesie10/error-default-branch

Conversation

@koesie10
Copy link
Copy Markdown
Member

When the GitHub API returns an error for a missing default branch, we will now show a custom error message. This custom error message includes a link to the page to create the branch. The error is detected using the errors field on the response that is now being returned.

Example response:

{
    "message": "Variant analysis failed because controller repository dsp-testing/koesie10-empty-repo does not have a branch 'main'. Please create a 'main' branch in the repository and re-run the variant analysis.",
    "errors": [
        {
            "repository": "dsp-testing/koesie10-empty-repo",
            "default_branch": "main",
            "resource": "Repository",
            "field": "default_branch",
            "code": "missing"
        }
    ]
}

Example error:

Screenshot 2023-10-17 at 14 58 58

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

When the GitHub API returns an error for a missing default branch, we
will now show a custom error message. This custom error message includes
a link to the page to create the branch. The error is detected using the
`errors` field on the response that is now being returned.
@koesie10 koesie10 requested a review from a team as a code owner October 17, 2023 13:00
Copy link
Copy Markdown
Contributor

@charisk charisk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@koesie10 koesie10 merged commit 30b51d9 into main Oct 18, 2023
@koesie10 koesie10 deleted the koesie10/error-default-branch branch October 18, 2023 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants