@@ -335,6 +335,9 @@ export const resolveDownloadMethods = {
335335 const batchWorkflowKey = this . getWorkflowScopedQueueKey ( ) ;
336336 let completed = 0 ;
337337 let failed = 0 ;
338+ let cancelled ;
339+ let batchError ;
340+ let hasBatchError = false ;
338341 try {
339342 for ( const missing of targets ) {
340343 if ( this . batchSearchCancelRequested ) {
@@ -351,20 +354,25 @@ export const resolveDownloadMethods = {
351354 completed += 1 ;
352355 this . updateBatchFooterButtons ( ) ;
353356 }
357+ } catch ( error ) {
358+ batchError = error ;
359+ hasBatchError = true ;
354360 } finally {
355- const cancelled = this . batchSearchCancelRequested ;
361+ cancelled = this . batchSearchCancelRequested ;
356362 this . batchSearchRunning = false ;
357363 this . batchSearchCancelRequested = false ;
358364 this . persistSearchStateForActiveWorkflow ( ) ;
359365 this . updateBatchFooterButtons ( ) ;
360- const suffix = failed ? `, ${ failed } failed` : '' ;
361- if ( cancelled ) {
362- this . showNotification ( `Stopped search after ${ completed } of ${ targets . length } model${ targets . length === 1 ? '' : 's' } ${ suffix } .` , 'info' ) ;
363- return ;
364- }
365366 }
366367
367368 const suffix = failed ? `, ${ failed } failed` : '' ;
369+ if ( cancelled ) {
370+ this . showNotification ( `Stopped search after ${ completed } of ${ targets . length } model${ targets . length === 1 ? '' : 's' } ${ suffix } .` , 'info' ) ;
371+ return ;
372+ }
373+ if ( hasBatchError ) {
374+ throw batchError ;
375+ }
368376 this . showNotification ( `Finished search for ${ completed } model${ completed === 1 ? '' : 's' } ${ suffix } .` , failed ? 'error' : 'success' ) ;
369377 } ,
370378
@@ -2904,15 +2912,15 @@ export const resolveDownloadMethods = {
29042912 const url = btn . dataset . url ;
29052913 const filename = btn . dataset . filename ;
29062914 const category = btn . dataset . category ;
2907- let pathMetadata = null ;
2915+ let pathMetadata ;
29082916 try {
29092917 pathMetadata = btn . dataset . pathMetadata
29102918 ? JSON . parse ( decodeURIComponent ( btn . dataset . pathMetadata ) )
29112919 : null ;
29122920 } catch ( _error ) {
29132921 pathMetadata = null ;
29142922 }
2915- let downloadMetadata = null ;
2923+ let downloadMetadata ;
29162924 try {
29172925 downloadMetadata = btn . dataset . downloadMetadata
29182926 ? JSON . parse ( decodeURIComponent ( btn . dataset . downloadMetadata ) )
0 commit comments