File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ interface VideoProcessingResult {
2626 } ;
2727}
2828
29+ function getErrorMessage ( error : unknown ) : string {
30+ return error instanceof Error ? error . message : String ( error ) ;
31+ }
32+
2933function getValidDuration ( duration : number ) {
3034 return Number . isFinite ( duration ) && duration > 0 ? duration : undefined ;
3135}
@@ -56,7 +60,7 @@ export async function processVideoWorkflow(
5660 metadata : result . metadata ,
5761 } ;
5862 } catch ( error ) {
59- await setProcessingError ( videoId , error ) ;
63+ await setProcessingError ( videoId , getErrorMessage ( error ) ) ;
6064 throw error ;
6165 }
6266}
@@ -286,19 +290,17 @@ async function cleanupRawUpload(
286290
287291async function setProcessingError (
288292 videoId : string ,
289- error : unknown ,
293+ errorMessage : string ,
290294) : Promise < void > {
291295 "use step" ;
292296
293- const message = error instanceof Error ? error . message : String ( error ) ;
294-
295297 await db ( )
296298 . update ( videoUploads )
297299 . set ( {
298300 phase : "error" ,
299301 processingProgress : 0 ,
300302 processingMessage : "Video processing failed" ,
301- processingError : message ,
303+ processingError : errorMessage ,
302304 updatedAt : new Date ( ) ,
303305 } )
304306 . where ( eq ( videoUploads . videoId , videoId as Video . VideoId ) ) ;
You can’t perform that action at this time.
0 commit comments