Skip to content

Commit 477cf17

Browse files
authored
Limit error message length (#905)
* Limit error message length * Update package.json
1 parent 908d1c7 commit 477cf17

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@snapshot-labs/snapshot.js",
3-
"version": "0.6.0",
3+
"version": "0.6.1",
44
"repository": "snapshot-labs/snapshot.js",
55
"license": "MIT",
66
"main": "dist/snapshot.cjs.js",

src/utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,16 @@ export async function subgraphRequest(url: string, query, options: any = {}) {
150150
responseData = JSON.parse(responseData);
151151
} catch (e) {
152152
throw new Error(
153-
`Errors found in subgraphRequest: URL: ${url}, Status: ${res.status}, Response: ${responseData}`
153+
`Errors found in subgraphRequest: URL: ${url}, Status: ${
154+
res.status
155+
}, Response: ${responseData.substring(0, 400)}`
154156
);
155157
}
156158
if (responseData.errors) {
157159
throw new Error(
158160
`Errors found in subgraphRequest: URL: ${url}, Status: ${
159161
res.status
160-
}, Response: ${JSON.stringify(responseData.errors)}`
162+
}, Response: ${JSON.stringify(responseData.errors).substring(0, 400)}`
161163
);
162164
}
163165
const { data } = responseData;

0 commit comments

Comments
 (0)