@@ -109,11 +109,11 @@ function ragifyApp() {
109109 this . newCollectionName = '' ;
110110 await this . loadCollections ( ) ;
111111 } else {
112- const data = await res . json ( ) ;
112+ const data = await res . json ( ) . catch ( ( ) => ( { } ) ) ;
113113 this . showToast ( data . detail || 'Failed to create collection' , 'error' ) ;
114114 }
115115 } catch ( e ) {
116- this . showToast ( ' Failed to create collection' , 'error' ) ;
116+ this . showToast ( ` Failed to create collection: ${ e . message || 'Network error' } ` , 'error' ) ;
117117 }
118118 } ,
119119
@@ -126,10 +126,11 @@ function ragifyApp() {
126126 this . showToast ( 'Collection deleted' , 'success' ) ;
127127 await this . loadCollections ( ) ;
128128 } else {
129- this . showToast ( 'Failed to delete collection' , 'error' ) ;
129+ const data = await res . json ( ) . catch ( ( ) => ( { } ) ) ;
130+ this . showToast ( data . detail || 'Failed to delete collection' , 'error' ) ;
130131 }
131132 } catch ( e ) {
132- this . showToast ( ' Failed to delete collection' , 'error' ) ;
133+ this . showToast ( ` Failed to delete collection: ${ e . message || 'Network error' } ` , 'error' ) ;
133134 }
134135 } ,
135136
@@ -195,12 +196,14 @@ function ragifyApp() {
195196 } ) ;
196197
197198 if ( res . ok ) {
198- this . showToast ( `Uploaded: ${ file . name } ` , 'success' ) ;
199+ const data = await res . json ( ) ;
200+ this . showToast ( `Uploaded: ${ file . name } (Job: ${ data . job_id ?. slice ( 0 , 8 ) || 'queued' } )` , 'success' ) ;
199201 } else {
200- this . showToast ( `Failed: ${ file . name } ` , 'error' ) ;
202+ const error = await res . json ( ) . catch ( ( ) => ( { } ) ) ;
203+ this . showToast ( `Failed: ${ file . name } - ${ error . detail || res . statusText } ` , 'error' ) ;
201204 }
202205 } catch ( e ) {
203- this . showToast ( `Failed: ${ file . name } ` , 'error' ) ;
206+ this . showToast ( `Failed: ${ file . name } - ${ e . message || 'Network error' } ` , 'error' ) ;
204207 }
205208 }
206209
@@ -235,11 +238,11 @@ function ragifyApp() {
235238 this . showToast ( 'No results found' , 'info' ) ;
236239 }
237240 } else {
238- const data = await res . json ( ) ;
241+ const data = await res . json ( ) . catch ( ( ) => ( { } ) ) ;
239242 this . showToast ( data . detail || 'Search failed' , 'error' ) ;
240243 }
241244 } catch ( e ) {
242- this . showToast ( ' Search failed' , 'error' ) ;
245+ this . showToast ( ` Search failed: ${ e . message || 'Network error' } ` , 'error' ) ;
243246 }
244247
245248 this . searching = false ;
0 commit comments