Skip to content

Commit

Permalink
Merge pull request #919 from o1-labs/fix/graphql-errors-check
Browse files Browse the repository at this point in the history
Add better error checking for fetched GraphQL requests
  • Loading branch information
MartinMinkov committed May 23, 2023
2 parents 1207ded + 58a4fc4 commit f2257f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Fixed

- Fix running SnarkyJS in Node.js on Windows https://github.com/o1-labs/snarkyjs-bindings/pull/19 (@wizicer)[https://github.com/wizicer]
- Fix error reporting from GraphQL requests https://github.com/o1-labs/snarkyjs/pull/919

## [0.10.1](https://github.com/o1-labs/snarkyjs/compare/bcc666f2...a632313a)

Expand Down
12 changes: 11 additions & 1 deletion src/lib/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,17 @@ async function checkResponseStatus(
undefined,
{
statusCode: response.status,
statusText: jsonResponse.errors,
statusText: jsonResponse.errors
.map((error: any) => error.message)
.join('\n'),
} as FetchError,
];
} else if (jsonResponse.data === undefined) {
return [
undefined,
{
statusCode: response.status,
statusText: `GraphQL response data is undefined`,
} as FetchError,
];
}
Expand Down

0 comments on commit f2257f6

Please sign in to comment.