Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): handle ng-packagr errors more gra…
Browse files Browse the repository at this point in the history
…cefully.

Ng-packagr will throw an error when a compilation fails.
  • Loading branch information
alan-agius4 authored and filipesilva committed Jun 21, 2021
1 parent e5ba29c commit ab17b17
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/angular_devkit/build_angular/src/ng-packagr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

import { BuilderContext, BuilderOutput, createBuilder } from '@angular-devkit/architect';
import { resolve } from 'path';
import { Observable, from } from 'rxjs';
import { mapTo, switchMap } from 'rxjs/operators';
import { Observable, from, of } from 'rxjs';
import { catchError, mapTo, switchMap } from 'rxjs/operators';
import { Schema as NgPackagrBuilderOptions } from './schema';

async function initialize(
Expand Down Expand Up @@ -37,6 +37,7 @@ export function execute(
return from(initialize(options, context.workspaceRoot)).pipe(
switchMap((packager) => (options.watch ? packager.watch() : packager.build())),
mapTo({ success: true }),
catchError((err) => of({ success: false, error: err.message })),
);
}

Expand Down

0 comments on commit ab17b17

Please sign in to comment.