Skip to content

Commit

Permalink
Limit error message length (#905)
Browse files Browse the repository at this point in the history
* Limit error message length

* Update package.json
  • Loading branch information
ChaituVR authored Sep 21, 2023
1 parent 908d1c7 commit 477cf17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@snapshot-labs/snapshot.js",
"version": "0.6.0",
"version": "0.6.1",
"repository": "snapshot-labs/snapshot.js",
"license": "MIT",
"main": "dist/snapshot.cjs.js",
Expand Down
6 changes: 4 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,16 @@ export async function subgraphRequest(url: string, query, options: any = {}) {
responseData = JSON.parse(responseData);
} catch (e) {
throw new Error(
`Errors found in subgraphRequest: URL: ${url}, Status: ${res.status}, Response: ${responseData}`
`Errors found in subgraphRequest: URL: ${url}, Status: ${
res.status
}, Response: ${responseData.substring(0, 400)}`
);
}
if (responseData.errors) {
throw new Error(
`Errors found in subgraphRequest: URL: ${url}, Status: ${
res.status
}, Response: ${JSON.stringify(responseData.errors)}`
}, Response: ${JSON.stringify(responseData.errors).substring(0, 400)}`
);
}
const { data } = responseData;
Expand Down

0 comments on commit 477cf17

Please sign in to comment.