File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -229,6 +229,11 @@ export class Uploader {
229
229
} ) ;
230
230
logger . debug ( "Upload complete" , this . componentId ) ;
231
231
} catch ( error ) {
232
+ try {
233
+ await this . cleanup ( ) ;
234
+ } catch ( cleanupError ) {
235
+ logger . error ( "Clean up failed" , cleanupError ) ;
236
+ }
232
237
if ( this . onError ) {
233
238
this . onError ( error as Error ) ;
234
239
}
@@ -464,16 +469,15 @@ export class Uploader {
464
469
) ;
465
470
this . xhr . open ( "PUT" , url , true ) ;
466
471
this . xhr . onabort = async ( ) => {
472
+ this . aborted = true ;
467
473
if ( this . onAborted ) {
468
474
this . onAborted ( ) ;
469
475
}
470
- await this . cleanup ( ) ;
471
476
reject (
472
477
new CreateComponentError ( "Upload aborted by client" , "UPLOAD_ABORTED" )
473
478
) ;
474
479
} ;
475
480
this . xhr . onerror = async ( ) => {
476
- await this . cleanup ( ) ;
477
481
reject (
478
482
new CreateComponentError ( `Failed to upload file: ${ this . xhr ! . status } ` )
479
483
) ;
You can’t perform that action at this time.
0 commit comments