Skip to content

api: handle HTTP 409 error message from the server#4862

Merged
mislav merged 1 commit intotrunkfrom
api-err-409
Dec 7, 2021
Merged

api: handle HTTP 409 error message from the server#4862
mislav merged 1 commit intotrunkfrom
api-err-409

Conversation

@mislav
Copy link
Contributor

@mislav mislav commented Dec 6, 2021

Previously, "errors" field was either an array of strings or an array of error objects. This covers an additional case when "errors" is a string:

$ gh api orgs/cli/actions/permissions/repositories
{
  "message": "Conflict",
  "errors": "Actions are enabled for all repositories",
  "documentation_url": "https://docs.github.com/rest/reference/actions#list-selected-repositories-enabled-for-github-actions-in-an-organization"
}

Fixes #4734

Previously, "errors" field was either an array of strings or an array of
error objects. This covers an additional case when "errors" is a string:

    $ gh api orgs/cli/actions/permissions/repositories
    {
      "message": "Conflict",
      "errors": "Actions are enabled for all repositories",
      "documentation_url": "https://docs.github.com/rest/reference/actions#list-selected-repositories-enabled-for-github-actions-in-an-organization"
    }
@mislav mislav requested a review from a team as a code owner December 6, 2021 18:57
@mislav mislav requested review from samcoe and removed request for a team December 6, 2021 18:57
Copy link
Contributor

@samcoe samcoe left a comment

Choose a reason for hiding this comment

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

LGTM, left one non-blocking comment. Kind of a bummer the API can return all these different error messages types.

@mislav mislav merged commit 29816b6 into trunk Dec 7, 2021
@mislav mislav deleted the api-err-409 branch December 7, 2021 18:37
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.

Unclear Error Handling for Status-Only API Response

2 participants