Skip to content

Commit 774e83d

Browse files
clydinalan-agius4
authored andcommitted
fix(@angular-devkit/architect): default to failure if no builder result is provided
Currently, if an architect builder does not provide any results, the CLI will crash trying to access an error message property on the result. Instead architect will now provide a default failure result `{ success: false }` in the event that the builder exits prior to generating a result. Thrown errors continue to be propagated as before.
1 parent f7ad20c commit 774e83d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/angular_devkit/architect/src/create-builder.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import { json, logging } from '@angular-devkit/core';
1010
import { Observable, Subscription, from, isObservable, of, throwError } from 'rxjs';
11-
import { mergeMap, tap } from 'rxjs/operators';
11+
import { defaultIfEmpty, mergeMap, tap } from 'rxjs/operators';
1212
import {
1313
BuilderContext,
1414
BuilderHandlerFn,
@@ -218,6 +218,7 @@ export function createBuilder<OptT = json.JsonObject, OutT extends BuilderOutput
218218
subscriptions.push(
219219
result
220220
.pipe(
221+
defaultIfEmpty({ success: false } as unknown),
221222
tap(() => {
222223
progress({ state: BuilderProgressState.Running, current: total }, context);
223224
progress({ state: BuilderProgressState.Stopped }, context);

0 commit comments

Comments
 (0)