File tree Expand file tree Collapse file tree
src/vs/workbench/services/textfile Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -598,26 +598,13 @@ export abstract class AbstractTextFileService extends Disposable implements ITex
598598 } ) ;
599599
600600 await Promise . all ( fileModels . map ( async model => {
601- try {
602- await model . revert ( options ) ;
603-
604- // If model is still dirty, mark the resulting operation as error
605- if ( model . isDirty ( ) ) {
606- const result = mapResourceToResult . get ( model . resource ) ;
607- if ( result ) {
608- result . error = true ;
609- }
610- }
611- } catch ( error ) {
612-
613- // FileNotFound means the file got deleted meanwhile, so ignore it
614- if ( ( < FileOperationError > error ) . fileOperationResult === FileOperationResult . FILE_NOT_FOUND ) {
615- return ;
616- }
601+ await model . revert ( options ) ;
617602
618- // Otherwise bubble up the error
619- else {
620- throw error ;
603+ // If model is still dirty, mark the resulting operation as error
604+ if ( model . isDirty ( ) ) {
605+ const result = mapResourceToResult . get ( model . resource ) ;
606+ if ( result ) {
607+ result . error = true ;
621608 }
622609 }
623610 } ) ) ;
Original file line number Diff line number Diff line change @@ -230,10 +230,14 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
230230 await this . load ( { forceReadFromDisk : true } ) ;
231231 } catch ( error ) {
232232
233- // Set flags back to previous values, we are still dirty if revert failed
234- undo ( ) ;
233+ // FileNotFound means the file got deleted meanwhile, so ignore it
234+ if ( ( < FileOperationError > error ) . fileOperationResult !== FileOperationResult . FILE_NOT_FOUND ) {
235235
236- throw error ;
236+ // Set flags back to previous values, we are still dirty if revert failed
237+ undo ( ) ;
238+
239+ throw error ;
240+ }
237241 }
238242 }
239243
You can’t perform that action at this time.
0 commit comments