@phpsandbox/sdk 0.1.14 → 0.1.15
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.
- package/dist/browser/phpsandbox-sdk.esm.js +18 -11
- package/dist/browser/phpsandbox-sdk.esm.min.js +9 -9
- package/dist/browser/phpsandbox-sdk.iife.js +18 -11
- package/dist/browser/phpsandbox-sdk.iife.min.js +9 -9
- package/dist/errors/index.d.ts +7 -1
- package/dist/errors/index.js +2 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +11 -10
- package/package.json +1 -1
|
@@ -100,9 +100,10 @@ var PHPSandbox = (() => {
|
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
var TransportError = class _TransportError extends PHPSandboxError {
|
|
103
|
-
constructor(message, code, cause) {
|
|
103
|
+
constructor(message, code, cause, response) {
|
|
104
104
|
super(message, cause);
|
|
105
105
|
this.code = code;
|
|
106
|
+
this.response = response;
|
|
106
107
|
}
|
|
107
108
|
static is(error51, code) {
|
|
108
109
|
return error51 instanceof _TransportError && (code === void 0 || error51.code === code);
|
|
@@ -19953,7 +19954,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19953
19954
|
})
|
|
19954
19955
|
);
|
|
19955
19956
|
if (!response.ok) {
|
|
19956
|
-
throw
|
|
19957
|
+
throw await responseError(response);
|
|
19957
19958
|
}
|
|
19958
19959
|
if (!response.body) {
|
|
19959
19960
|
throw new TransportError("PHPSandbox API response body is not readable.", "InvalidResponse", response);
|
|
@@ -19971,7 +19972,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19971
19972
|
})
|
|
19972
19973
|
);
|
|
19973
19974
|
if (!response.ok) {
|
|
19974
|
-
throw
|
|
19975
|
+
throw await responseError(response);
|
|
19975
19976
|
}
|
|
19976
19977
|
if (!response.body) {
|
|
19977
19978
|
throw new TransportError("PHPSandbox API SSE response body is not readable.", "InvalidResponse", response);
|
|
@@ -19987,7 +19988,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19987
19988
|
})
|
|
19988
19989
|
);
|
|
19989
19990
|
if (!response.ok) {
|
|
19990
|
-
throw
|
|
19991
|
+
throw await responseError(response);
|
|
19991
19992
|
}
|
|
19992
19993
|
if (response.status === 204) {
|
|
19993
19994
|
return { data: void 0 };
|
|
@@ -20020,15 +20021,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20020
20021
|
}
|
|
20021
20022
|
}
|
|
20022
20023
|
};
|
|
20023
|
-
async function
|
|
20024
|
+
async function responseError(response) {
|
|
20024
20025
|
const body = await response.text();
|
|
20025
|
-
if (body === "") {
|
|
20026
|
-
return void 0;
|
|
20027
|
-
}
|
|
20028
20026
|
try {
|
|
20029
|
-
return JSON.parse(body);
|
|
20030
|
-
} catch
|
|
20031
|
-
|
|
20027
|
+
return remoteError("core", errorPayload(body === "" ? void 0 : JSON.parse(body)), response);
|
|
20028
|
+
} catch {
|
|
20029
|
+
return new TransportError(
|
|
20030
|
+
`PHPSandbox API returned an invalid error response (HTTP ${response.status}).`,
|
|
20031
|
+
"InvalidResponse",
|
|
20032
|
+
response,
|
|
20033
|
+
{
|
|
20034
|
+
status: response.status,
|
|
20035
|
+
statusText: response.statusText,
|
|
20036
|
+
body
|
|
20037
|
+
}
|
|
20038
|
+
);
|
|
20032
20039
|
}
|
|
20033
20040
|
}
|
|
20034
20041
|
function errorPayload(payload) {
|