File tree Expand file tree Collapse file tree 2 files changed +39
-18
lines changed
apps/desktop/src/routes/(window-chrome)/settings Expand file tree Collapse file tree 2 files changed +39
-18
lines changed Original file line number Diff line number Diff line change @@ -16,24 +16,30 @@ export default function Recordings() {
1616 const fetchRecordings = createQuery ( ( ) => ( {
1717 queryKey : [ "recordings" ] ,
1818 queryFn : async ( ) => {
19- const result = await commands . listRecordings ( ) ;
20- if ( result . status === "ok" ) {
21- const recordings = await Promise . all (
22- result . data . map ( async ( file ) => {
23- const [ id , path , meta ] = file ;
24- const thumbnailPath = `${ path } /screenshots/display.jpg` ;
19+ try {
20+ const result = await commands . listRecordings ( ) ;
21+ if ( result . status === "ok" ) {
22+ const recordings = await Promise . all (
23+ result . data . map ( async ( file ) => {
24+ const [ id , path , meta ] = file ;
25+ const thumbnailPath = `${ path } /screenshots/display.jpg` ;
2526
26- return {
27- id,
28- path,
29- prettyName : meta . pretty_name ,
30- isNew : false ,
31- thumbnailPath,
32- } ;
33- } )
34- ) ;
35- return recordings ;
36- } else {
27+ return {
28+ id,
29+ path,
30+ prettyName : meta . pretty_name ,
31+ isNew : false ,
32+ thumbnailPath,
33+ } ;
34+ } )
35+ ) ;
36+ return recordings ;
37+ } else {
38+ console . error ( "Failed to list recordings:" , result . error ) ;
39+ return [ ] ;
40+ }
41+ } catch ( error ) {
42+ console . error ( "Error fetching recordings:" , error ) ;
3743 return [ ] ;
3844 }
3945 } ,
Original file line number Diff line number Diff line change @@ -53,7 +53,22 @@ pub struct RecordingMeta {
5353impl RecordingMeta {
5454 pub fn load_for_project ( project_path : & PathBuf ) -> Result < Self , String > {
5555 let meta_path = project_path. join ( "recording-meta.json" ) ;
56- let meta = std:: fs:: read_to_string ( meta_path) . map_err ( |e| e. to_string ( ) ) ?;
56+ let meta = match std:: fs:: read_to_string ( & meta_path) {
57+ Ok ( content) => content,
58+ Err ( _) => {
59+ return Ok ( Self {
60+ project_path : project_path. clone ( ) ,
61+ pretty_name : String :: new ( ) ,
62+ sharing : None ,
63+ display : Display {
64+ path : PathBuf :: new ( ) ,
65+ } ,
66+ camera : None ,
67+ audio : None ,
68+ segments : Vec :: new ( ) ,
69+ } ) ;
70+ }
71+ } ;
5772 let mut meta: Self = serde_json:: from_str ( & meta) . map_err ( |e| e. to_string ( ) ) ?;
5873 meta. project_path = project_path. clone ( ) ;
5974 Ok ( meta)
You can’t perform that action at this time.
0 commit comments