@decocms/apps-vtex 7.34.3 → 7.34.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +5 -5
  2. package/src/client.ts +8 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/apps-vtex",
3
- "version": "7.34.3",
3
+ "version": "7.34.4",
4
4
  "type": "module",
5
5
  "description": "Deco commerce app: VTEX integration",
6
6
  "repository": {
@@ -51,10 +51,10 @@
51
51
  "lint:unused": "knip"
52
52
  },
53
53
  "dependencies": {
54
- "@decocms/blocks": "7.34.3",
55
- "@decocms/apps-commerce": "7.34.3",
56
- "@decocms/apps-website": "7.34.3",
57
- "@decocms/tanstack": "7.34.3"
54
+ "@decocms/blocks": "7.34.4",
55
+ "@decocms/apps-commerce": "7.34.4",
56
+ "@decocms/apps-website": "7.34.4",
57
+ "@decocms/tanstack": "7.34.4"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@tanstack/react-query": ">=5.0.0",
package/src/client.ts CHANGED
@@ -325,7 +325,14 @@ export async function vtexFetchResponse(
325
325
  headers: mergeHeaders(authHeaders(), segmentCookie, init?.headers),
326
326
  });
327
327
  if (!response.ok) {
328
- throw new Error(`VTEX API error: ${response.status} ${response.statusText} - ${url}`);
328
+ // Include the response body: VTEX returns actionable detail here
329
+ // (e.g. MasterData "duplicated entry"), and without it callers can't
330
+ // distinguish error kinds and are forced to reimplement the fetch to
331
+ // read the body themselves. Safe to consume — we throw, not return.
332
+ const body = await response.text().catch(() => "");
333
+ throw new Error(
334
+ `VTEX API error: ${response.status} ${response.statusText} - ${url}${body ? ` - ${body}` : ""}`,
335
+ );
329
336
  }
330
337
  return response;
331
338
  }