Skip to content

Commit

Permalink
chore: stringified json response for web, node and deno
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiragAgg5k committed Jan 27, 2025
1 parent c385fa7 commit 1447dba
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion templates/deno/src/client.ts.twig
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class Client {
} catch (error) {
throw new {{spec.title | caseUcfirst}}Exception(text, response.status, "", text);
}
throw new {{spec.title | caseUcfirst}}Exception(json.message, json.code, json.type, json);
throw new {{spec.title | caseUcfirst}}Exception(json.message, json.code, json.type, JSON.stringify(json));
}

if (responseType === "arraybuffer") {
Expand Down
2 changes: 1 addition & 1 deletion templates/node/src/client.ts.twig
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ class Client {
}

if (400 <= response.status) {
throw new {{spec.title | caseUcfirst}}Exception(data?.message, response.status, data?.type, data);
throw new {{spec.title | caseUcfirst}}Exception(data?.message, response.status, data?.type, JSON.stringify(data));
}

return data;
Expand Down
2 changes: 1 addition & 1 deletion templates/web/src/client.ts.twig
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ class Client {
}

if (400 <= response.status) {
throw new {{spec.title | caseUcfirst}}Exception(data?.message, response.status, data?.type, data);
throw new {{spec.title | caseUcfirst}}Exception(data?.message, response.status, data?.type, JSON.stringify(data));
}

const cookieFallback = response.headers.get('X-Fallback-Cookies');
Expand Down

0 comments on commit 1447dba

Please sign in to comment.