ai 4.3.18 → 4.3.19
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/CHANGELOG.md +6 -0
- package/dist/index.js +18 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -485,19 +485,7 @@ function recordSpan({
|
|
485
485
|
return result;
|
486
486
|
} catch (error) {
|
487
487
|
try {
|
488
|
-
|
489
|
-
span.recordException({
|
490
|
-
name: error.name,
|
491
|
-
message: error.message,
|
492
|
-
stack: error.stack
|
493
|
-
});
|
494
|
-
span.setStatus({
|
495
|
-
code: SpanStatusCode.ERROR,
|
496
|
-
message: error.message
|
497
|
-
});
|
498
|
-
} else {
|
499
|
-
span.setStatus({ code: SpanStatusCode.ERROR });
|
500
|
-
}
|
488
|
+
recordErrorOnSpan(span, error);
|
501
489
|
} finally {
|
502
490
|
span.end();
|
503
491
|
}
|
@@ -505,6 +493,21 @@ function recordSpan({
|
|
505
493
|
}
|
506
494
|
});
|
507
495
|
}
|
496
|
+
function recordErrorOnSpan(span, error) {
|
497
|
+
if (error instanceof Error) {
|
498
|
+
span.recordException({
|
499
|
+
name: error.name,
|
500
|
+
message: error.message,
|
501
|
+
stack: error.stack
|
502
|
+
});
|
503
|
+
span.setStatus({
|
504
|
+
code: SpanStatusCode.ERROR,
|
505
|
+
message: error.message
|
506
|
+
});
|
507
|
+
} else {
|
508
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
509
|
+
}
|
510
|
+
}
|
508
511
|
|
509
512
|
// core/telemetry/select-telemetry-attributes.ts
|
510
513
|
function selectTelemetryAttributes({
|
@@ -4579,6 +4582,7 @@ async function executeTools({
|
|
4579
4582
|
}
|
4580
4583
|
return result2;
|
4581
4584
|
} catch (error) {
|
4585
|
+
recordErrorOnSpan(span, error);
|
4582
4586
|
throw new ToolExecutionError({
|
4583
4587
|
toolCallId,
|
4584
4588
|
toolName,
|
@@ -5105,6 +5109,7 @@ function runToolsTransformation({
|
|
5105
5109
|
}
|
5106
5110
|
},
|
5107
5111
|
(error) => {
|
5112
|
+
recordErrorOnSpan(span, error);
|
5108
5113
|
toolResultsStreamController.enqueue({
|
5109
5114
|
type: "error",
|
5110
5115
|
error: new ToolExecutionError({
|