File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -198,8 +198,8 @@ export function isVideoSourceExtractionError(error: unknown): error is VideoSour
198198 return (
199199 typeof error === "object" &&
200200 error !== null &&
201- ( error as { hyperframesVideoSourceExtractionError ?: unknown } )
202- . hyperframesVideoSourceExtractionError === true
201+ " hyperframesVideoSourceExtractionError" in error &&
202+ error . hyperframesVideoSourceExtractionError === true
203203 ) ;
204204}
205205
Original file line number Diff line number Diff line change @@ -118,22 +118,19 @@ interface PreparedRenderInput {
118118}
119119
120120const DEFAULT_SERVER_FPS = { num : 30 , den : 1 } as const ;
121- const SAFE_RENDER_ERROR_CODES = new Set ( [
121+ const SAFE_RENDER_ERROR_CODES = new Set < string > ( [
122122 "VIDEO_SOURCE_UNRENDERABLE" ,
123123 "VIDEO_EXTRACTION_FAILED" ,
124- ] as const ) ;
124+ ] ) ;
125125
126126/**
127127 * Preserve only bounded producer error codes across JSON/SSE. Never derive a
128128 * code from the message: it may contain local paths or signed source URLs.
129129 */
130130export function extractSafeRenderErrorCode ( error : unknown ) : string | undefined {
131131 if ( typeof error !== "object" || error === null || ! ( "code" in error ) ) return undefined ;
132- const code = ( error as { code ?: unknown } ) . code ;
133- return typeof code === "string" &&
134- SAFE_RENDER_ERROR_CODES . has ( code as "VIDEO_SOURCE_UNRENDERABLE" | "VIDEO_EXTRACTION_FAILED" )
135- ? code
136- : undefined ;
132+ const code = error . code ;
133+ return typeof code === "string" && SAFE_RENDER_ERROR_CODES . has ( code ) ? code : undefined ;
137134}
138135
139136function parseServerFps ( value : unknown ) : RenderInput [ "fps" ] {
Original file line number Diff line number Diff line change @@ -193,8 +193,11 @@ describe("assertVideoExtractionSucceeded", () => {
193193 { kind : "zero_output" , count : 1 } ,
194194 ] ,
195195 } ) ;
196- expect ( ( caught as Error ) . message ) . not . toContain ( "/tmp/" ) ;
197- expect ( ( caught as Error ) . message ) . not . toContain ( "Signature" ) ;
196+ if ( ! ( caught instanceof Error ) ) {
197+ throw new Error ( "expected VideoExtractionStageError" ) ;
198+ }
199+ expect ( caught . message ) . not . toContain ( "/tmp/" ) ;
200+ expect ( caught . message ) . not . toContain ( "Signature" ) ;
198201 } ) ;
199202
200203 it ( "keeps exhausted transient failures retryable and collapses duplicate kinds" , ( ) => {
You can’t perform that action at this time.
0 commit comments