@gammatech/aijsx 0.7.1-dev.2024-05-14 → 0.7.2-dev.2024-05-22
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.js +10 -2
- package/dist/index.mjs +10 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -647,13 +647,15 @@ var AISpan = class {
|
|
|
647
647
|
if (typeof exception === "string") {
|
|
648
648
|
attributes = {
|
|
649
649
|
name: "Error",
|
|
650
|
-
message: exception
|
|
650
|
+
message: exception,
|
|
651
|
+
error: exception
|
|
651
652
|
};
|
|
652
653
|
} else {
|
|
653
654
|
attributes = {
|
|
654
655
|
name: exception.name,
|
|
655
656
|
message: exception.message,
|
|
656
|
-
stack: exception.stack
|
|
657
|
+
stack: exception.stack,
|
|
658
|
+
error: exception
|
|
657
659
|
};
|
|
658
660
|
}
|
|
659
661
|
return this.addEvent("exception", attributes, time);
|
|
@@ -1464,12 +1466,18 @@ async function* Retry({ shouldRetry: shouldRetry4, retries = 0, maxRetries = 3,
|
|
|
1464
1466
|
if (hasYieldedData || retries >= maxRetries || !shouldRetry4(e)) {
|
|
1465
1467
|
throw e;
|
|
1466
1468
|
}
|
|
1469
|
+
await backoff(retries);
|
|
1467
1470
|
yield* Retry(
|
|
1468
1471
|
{ shouldRetry: shouldRetry4, retries: retries + 1, maxRetries, children },
|
|
1469
1472
|
ctx
|
|
1470
1473
|
);
|
|
1471
1474
|
}
|
|
1472
1475
|
}
|
|
1476
|
+
var BASE_BACKOFF = 100;
|
|
1477
|
+
var backoff = (retries) => {
|
|
1478
|
+
const waitTime = BASE_BACKOFF * Math.pow(4, retries);
|
|
1479
|
+
return new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
1480
|
+
};
|
|
1473
1481
|
|
|
1474
1482
|
// src/fallback.tsx
|
|
1475
1483
|
async function* Fallback({ shouldFallback = () => true, fallback, children }, ctx) {
|
package/dist/index.mjs
CHANGED
|
@@ -550,13 +550,15 @@ var AISpan = class {
|
|
|
550
550
|
if (typeof exception === "string") {
|
|
551
551
|
attributes = {
|
|
552
552
|
name: "Error",
|
|
553
|
-
message: exception
|
|
553
|
+
message: exception,
|
|
554
|
+
error: exception
|
|
554
555
|
};
|
|
555
556
|
} else {
|
|
556
557
|
attributes = {
|
|
557
558
|
name: exception.name,
|
|
558
559
|
message: exception.message,
|
|
559
|
-
stack: exception.stack
|
|
560
|
+
stack: exception.stack,
|
|
561
|
+
error: exception
|
|
560
562
|
};
|
|
561
563
|
}
|
|
562
564
|
return this.addEvent("exception", attributes, time);
|
|
@@ -1360,12 +1362,18 @@ async function* Retry({ shouldRetry: shouldRetry4, retries = 0, maxRetries = 3,
|
|
|
1360
1362
|
if (hasYieldedData || retries >= maxRetries || !shouldRetry4(e)) {
|
|
1361
1363
|
throw e;
|
|
1362
1364
|
}
|
|
1365
|
+
await backoff(retries);
|
|
1363
1366
|
yield* Retry(
|
|
1364
1367
|
{ shouldRetry: shouldRetry4, retries: retries + 1, maxRetries, children },
|
|
1365
1368
|
ctx
|
|
1366
1369
|
);
|
|
1367
1370
|
}
|
|
1368
1371
|
}
|
|
1372
|
+
var BASE_BACKOFF = 100;
|
|
1373
|
+
var backoff = (retries) => {
|
|
1374
|
+
const waitTime = BASE_BACKOFF * Math.pow(4, retries);
|
|
1375
|
+
return new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
1376
|
+
};
|
|
1369
1377
|
|
|
1370
1378
|
// src/fallback.tsx
|
|
1371
1379
|
async function* Fallback({ shouldFallback = () => true, fallback, children }, ctx) {
|