GitHub API dataCorrupted error
- Dominant language
- Swift
- Stars
- 1.1k
- Forks
- 152
- Avg merge
- 9h 54m
- Merged PRs (30d)
- 2
Description
Trying to get the comments on a PR.
Code:
```swift
let group = DispatchGroup()
group.enter()
_ = danger.github.api.issueComments(
owner: "foo",
repository: "bar",
number: danger.github.issue.number) { (response: Response<[Comment]>) in
switch response {
case .success(let comments):
// do stuff
case .failure(let error):
print("[ERROR]: ", error)
}
group.leave()
)
group.wait()
```
Issues:
1. I needed to add the DispatchGroup logic otherwise it seemed to end before getting the response back from the Octokit
2. I get: [ERROR]: dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 1." UserInfo={NSDebugDescription=Invalid value around character 1.})))
Not really sure how to even debug. Any idea why this is happening/how to fix?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.