mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 11:26:02 +00:00
* fix(producer): a render that fails on a missing file says what was gone * fix(producer): a failed look at what was missing never hides the render's own error The missing-path probe now returns nothing when it throws, reads through at most four links and only links that point into the temp root or the cache folder, names a removed folder by its own name, treats a custom cache folder as the cache, and skips programs that could not start. * refactor(producer): split the missing-path link walk into its own step
22 lines
908 B
TypeScript
22 lines
908 B
TypeScript
import { missingPathOf } from "@hyperframes/core/missing-path";
|
|
|
|
const KINDS: ReadonlyArray<[RegExp, string]> = [
|
|
[/(^|[\\/])hfcache-/, "extract_cache"],
|
|
[/(^|[\\/])__hyperframes_video_frames([\\/]|$)/, "video_frames"],
|
|
[/(^|[\\/])captured-frames([\\/]|$)/, "captured_frames"],
|
|
[
|
|
/(^|[\\/])(capture-attempt-\d+|retry-\d+-batch-\d+-worker-\d+|worker-\d+)([\\/]|$)/,
|
|
"worker_frames",
|
|
],
|
|
[/(^|[\\/])capture-calibration/, "calibration"],
|
|
[/(^|[\\/])compiled([\\/]|$)/, "compiled"],
|
|
[/(^|[\\/])(hf-render-|work-[0-9a-f]{8}-)/, "work_dir"],
|
|
];
|
|
|
|
/** Which kind of file a render found missing (a fixed name, never the path), or undefined when nothing was missing. */
|
|
export function missingPathKind(error: unknown): string | undefined {
|
|
const path = missingPathOf(error);
|
|
if (path === undefined) return undefined;
|
|
return KINDS.find(([pattern]) => pattern.test(path))?.[1] ?? "other";
|
|
}
|