@superlinked/sie-sdk 0.3.1 → 0.3.2
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/index.cjs +28 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -382,20 +382,35 @@ async function throwIfModelLoadFailed(response, model) {
|
|
|
382
382
|
}
|
|
383
383
|
async function handleError(response, gpu) {
|
|
384
384
|
const { status } = response;
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
385
|
+
const detail = await getErrorDetail(response.clone());
|
|
386
|
+
let code;
|
|
387
|
+
let message;
|
|
388
|
+
if (detail) {
|
|
389
|
+
const c = detail.code;
|
|
390
|
+
code = typeof c === "string" ? c : void 0;
|
|
391
|
+
const m = detail.message;
|
|
392
|
+
message = typeof m === "string" ? m : JSON.stringify(detail);
|
|
393
|
+
} else {
|
|
394
|
+
try {
|
|
395
|
+
const data = await response.json();
|
|
396
|
+
if (typeof data.detail === "string") {
|
|
397
|
+
code = typeof data.code === "string" ? data.code : void 0;
|
|
398
|
+
message = data.detail;
|
|
399
|
+
} else if (typeof data.message === "string") {
|
|
400
|
+
code = typeof data.code === "string" ? data.code : void 0;
|
|
401
|
+
message = data.message;
|
|
402
|
+
} else {
|
|
403
|
+
code = typeof data.code === "string" ? data.code : void 0;
|
|
404
|
+
message = response.statusText;
|
|
405
|
+
}
|
|
406
|
+
} catch {
|
|
407
|
+
code = void 0;
|
|
408
|
+
message = response.statusText;
|
|
409
|
+
}
|
|
389
410
|
}
|
|
390
|
-
const code = errorBody.code ?? "UNKNOWN";
|
|
391
|
-
const message = errorBody.detail ?? response.statusText;
|
|
392
411
|
if (status === HTTP_ACCEPTED) {
|
|
393
|
-
const retryAfter = response
|
|
394
|
-
throw new ProvisioningError(
|
|
395
|
-
message,
|
|
396
|
-
gpu,
|
|
397
|
-
retryAfter ? Number.parseInt(retryAfter, 10) * 1e3 : void 0
|
|
398
|
-
);
|
|
412
|
+
const retryAfter = getRetryAfter2(response);
|
|
413
|
+
throw new ProvisioningError(message, gpu, retryAfter);
|
|
399
414
|
}
|
|
400
415
|
if (status >= HTTP_CLIENT_ERROR_MIN && status <= HTTP_CLIENT_ERROR_MAX) {
|
|
401
416
|
throw new RequestError(message, code, status);
|
|
@@ -516,7 +531,7 @@ function parseCapacityInfo(data, gpuFilter) {
|
|
|
516
531
|
}
|
|
517
532
|
|
|
518
533
|
// src/version.ts
|
|
519
|
-
var SDK_VERSION = "0.3.
|
|
534
|
+
var SDK_VERSION = "0.3.2";
|
|
520
535
|
|
|
521
536
|
// src/client.ts
|
|
522
537
|
function sleep(ms) {
|