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