Files
hyperframes/packages/engine/src/services/captureWarning.ts
T
James Russo 37b88688e7 fix(audio): preserve causes and use portable padding (#2769)
* fix(audio): preserve causes and use portable padding

* fix(audio): address failure taxonomy review
2026-07-25 17:12:31 -04:00

25 lines
847 B
TypeScript

import type { CaptureWarning } from "../types.js";
/** Clone every mutable field before a warning crosses an async or ownership boundary. */
export function cloneCaptureWarning<T extends CaptureWarning>(warning: T): T {
return {
...warning,
details: warning.details
? {
...warning.details,
sources: warning.details.sources ? [...warning.details.sources] : undefined,
failureReasons: warning.details.failureReasons
? [...warning.details.failureReasons]
: undefined,
failureStages: warning.details.failureStages
? [...warning.details.failureStages]
: undefined,
}
: undefined,
} as T;
}
export function cloneCaptureWarnings<T extends CaptureWarning>(warnings: readonly T[]): T[] {
return warnings.map(cloneCaptureWarning);
}