@readyfor/api-client-base 0.215.0-pr977.5be7122 → 0.215.0-pr977.c06f33c

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.
@@ -10,7 +10,12 @@ import {
10
10
  var defaultRequestInit = {
11
11
  credentials: "include"
12
12
  };
13
- var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => createTextFetcher(customRequestInit)(input, requestInit).then((text) => {
13
+ var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => createTextFetcher(customRequestInit)(input, requestInit).catch((e) => {
14
+ if (e instanceof HTTPError && typeof e.body === "string" && e.body.length > 0) {
15
+ throw new HTTPError(e.status, JSON.parse(e.body));
16
+ }
17
+ throw e;
18
+ }).then((text) => {
14
19
  const parsedResponse = JSON.parse(text);
15
20
  const result = schema.safeParse(parsedResponse);
16
21
  const config = store.getState();
package/dist/fetcher.js CHANGED
@@ -101,7 +101,12 @@ var store = createStore(defaultConfig);
101
101
  var defaultRequestInit = {
102
102
  credentials: "include"
103
103
  };
104
- var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => createTextFetcher(customRequestInit)(input, requestInit).then((text) => {
104
+ var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => createTextFetcher(customRequestInit)(input, requestInit).catch((e) => {
105
+ if (e instanceof HTTPError && typeof e.body === "string" && e.body.length > 0) {
106
+ throw new HTTPError(e.status, JSON.parse(e.body));
107
+ }
108
+ throw e;
109
+ }).then((text) => {
105
110
  const parsedResponse = JSON.parse(text);
106
111
  const result = schema.safeParse(parsedResponse);
107
112
  const config = store.getState();
package/dist/fetcher.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createJsonFetcher,
4
4
  createTextFetcher,
5
5
  createVoidFetcher
6
- } from "./chunk-XDHAVIKP.mjs";
6
+ } from "./chunk-Q3TOTGEF.mjs";
7
7
  import "./chunk-PY35XWDS.mjs";
8
8
  import "./chunk-JCZWXJBU.mjs";
9
9
  import "./chunk-472P3XVV.mjs";
package/dist/index.js CHANGED
@@ -138,7 +138,12 @@ var getErrorStatus = (response) => {
138
138
  var defaultRequestInit = {
139
139
  credentials: "include"
140
140
  };
141
- var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => createTextFetcher(customRequestInit)(input, requestInit).then((text) => {
141
+ var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => createTextFetcher(customRequestInit)(input, requestInit).catch((e) => {
142
+ if (e instanceof HTTPError && typeof e.body === "string" && e.body.length > 0) {
143
+ throw new HTTPError(e.status, JSON.parse(e.body));
144
+ }
145
+ throw e;
146
+ }).then((text) => {
142
147
  const parsedResponse = JSON.parse(text);
143
148
  const result = schema.safeParse(parsedResponse);
144
149
  const config = store.getState();
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createJsonFetcher,
4
4
  createTextFetcher,
5
5
  createVoidFetcher
6
- } from "./chunk-XDHAVIKP.mjs";
6
+ } from "./chunk-Q3TOTGEF.mjs";
7
7
  import {
8
8
  HTTPError,
9
9
  errorStatusCode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readyfor/api-client-base",
3
- "version": "0.215.0-pr977.5be7122",
3
+ "version": "0.215.0-pr977.c06f33c",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",