466
const errorText = getResultErrorText(message);
467
if (errorText !== undefined) {
469
>
kind: 'action',
470
>
resource: session,
471
>
action: {
472
>
type: ActionType.ChatError,
473
>
turnId,
474
>
duration: typeof turnDuration === 'number' && Number.isFinite(turnDuration) ? Math.max(0, turnDuration) : 0,
475
>
error: {
476
>
errorType: message.subtype,
477
>
...extractForwardedErrorInfo(errorText),
478
>
},
479
>
},
480
>
});
481
>
}
482
// `ChatTurnComplete` is emitted by the session via
483
// `ClaudeSdkPipeline.onTurnComplete`, NOT here. The pipeline knows