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 {
229229 } ) ;
230230 logger . debug ( "Upload complete" , this . componentId ) ;
231231 } catch ( error ) {
232+ try {
233+ await this . cleanup ( ) ;
234+ } catch ( cleanupError ) {
235+ logger . error ( "Clean up failed" , cleanupError ) ;
236+ }
232237 if ( this . onError ) {
233238 this . onError ( error as Error ) ;
234239 }
@@ -464,16 +469,15 @@ export class Uploader {
464469 ) ;
465470 this . xhr . open ( "PUT" , url , true ) ;
466471 this . xhr . onabort = async ( ) => {
472+ this . aborted = true ;
467473 if ( this . onAborted ) {
468474 this . onAborted ( ) ;
469475 }
470- await this . cleanup ( ) ;
471476 reject (
472477 new CreateComponentError ( "Upload aborted by client" , "UPLOAD_ABORTED" )
473478 ) ;
474479 } ;
475480 this . xhr . onerror = async ( ) => {
476- await this . cleanup ( ) ;
477481 reject (
478482 new CreateComponentError ( `Failed to upload file: ${ this . xhr ! . status } ` )
479483 ) ;
You can’t perform that action at this time.
0 commit comments