Skip to content

Commit e3e7877

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. (cherry picked from commit 774e83d)
1 parent 12b2dc5 commit e3e7877

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 { analytics, experimental, 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,
@@ -219,6 +219,7 @@ export function createBuilder<OptT = json.JsonObject, OutT extends BuilderOutput
219219
subscriptions.push(
220220
result
221221
.pipe(
222+
defaultIfEmpty({ success: false } as unknown),
222223
tap(() => {
223224
progress({ state: BuilderProgressState.Running, current: total }, context);
224225
progress({ state: BuilderProgressState.Stopped }, context);

0 commit comments

Comments
 (0)