Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.

Commit

Permalink
fix(@angular-devkit/core): throw observable error on delete
Browse files Browse the repository at this point in the history
  • Loading branch information
filipesilva committed May 24, 2018
1 parent 6684382 commit 6647c34
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/angular_devkit/core/node/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import * as fs from 'fs';
import { EMPTY, Observable, concat, from as observableFrom } from 'rxjs';
import { EMPTY, Observable, concat, from as observableFrom, throwError } from 'rxjs';
import {
concatMap,
ignoreElements,
Expand Down Expand Up @@ -257,9 +257,17 @@ export class NodeJsSyncHost implements virtualFs.Host<fs.Stats> {
for (const name of fs.readdirSync(getSystemPath(path))) {
this.delete(join(path, name)).subscribe();
}
fs.rmdirSync(getSystemPath(path));
try {
fs.rmdirSync(getSystemPath(path));
} catch (error) {
return throwError(error);
}
} else {
fs.unlinkSync(getSystemPath(path));
try {
fs.unlinkSync(getSystemPath(path));
} catch (error) {
return throwError(error);
}
}

return EMPTY;
Expand Down

0 comments on commit 6647c34

Please sign in to comment.