We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4b71080 commit 80ba24fCopy full SHA for 80ba24f
1 file changed
packages/passport/sdk/src/zkEvm/relayerClient.ts
@@ -120,7 +120,16 @@ export class RelayerClient {
120
body: JSON.stringify(body),
121
});
122
123
- const jsonResponse = await response.json();
+ const responseText = await response.text();
124
+ let jsonResponse;
125
+ try {
126
+ jsonResponse = JSON.parse(responseText);
127
+ } catch (parseError) {
128
+ const preview = responseText.length > 100
129
+ ? `${responseText.substring(0, 50)}...${responseText.substring(responseText.length - 50)}`
130
+ : responseText;
131
+ throw new Error(`Relayer JSON parse error: ${parseError instanceof Error ? parseError.message : 'Unknown error'}. Content: "${preview}"`);
132
+ }
133
if (jsonResponse.error) {
134
throw jsonResponse.error;
135
}
0 commit comments