Skip to content

Pull Request Reviews (Preview API) methods have unusual error format that is not parsed. #540

@dmitshur

Description

@dmitshur

Pull Request Reviews (Preview API) methods were tracked in #495 and implemented in #497. They currently seem to use an unusual format for errors, and go-github does not parse that format.

Originally discovered by @haya14busa during review of #497:

As I posted request and error response example (#497 (comment)), error format for review API is not same as http://developer.github.com/v3/#client-errors

"errors" is list of string for review API.

{
  "message": "Validation Failed",
  "errors": [
    "Cannot return null for non-nullable field PullRequestReviewComment.position"
  ],
  "documentation_url": "https://developer.github.com/v3/pulls/reviews/#get-a-single-reviews-comments"
}

Corresponding go-github struct (ErrorResponse) is here.

type ErrorResponse struct {

Because ErrorResponse doesn't support review API error format, error information is dropped with unmarshalling and it's really difficult to debug error using go-github.
(I tried to implement create review API in my personal project reviewdog/reviewdog#63 using go-github, but it was really hard to debug error... )

I'll report this problem to GitHub support, but this review API error fromat could be intentional.
If so, we have to handle this problem I guess.

See #497 (comment) for full context and details.

This issue is to track that problem (which will soon be merged into master) and resolve it afterwards. The unusual error format is not documented, and we're waiting on GitHub to potentially fix the error format for those endpoints, or update documentation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions