Skip to content

Commit

Permalink
fix(@angular-devkit/architect): default to failure if no builder resu…
Browse files Browse the repository at this point in the history
…lt 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)
  • Loading branch information
clydin authored and alan-agius4 committed Nov 8, 2022
1 parent 12b2dc5 commit e3e7877
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/angular_devkit/architect/src/create-builder.ts
Expand Up @@ -8,7 +8,7 @@

import { analytics, experimental, json, logging } from '@angular-devkit/core';
import { Observable, Subscription, from, isObservable, of, throwError } from 'rxjs';
import { mergeMap, tap } from 'rxjs/operators';
import { defaultIfEmpty, mergeMap, tap } from 'rxjs/operators';
import {
BuilderContext,
BuilderHandlerFn,
Expand Down Expand Up @@ -219,6 +219,7 @@ export function createBuilder<OptT = json.JsonObject, OutT extends BuilderOutput
subscriptions.push(
result
.pipe(
defaultIfEmpty({ success: false } as unknown),
tap(() => {
progress({ state: BuilderProgressState.Running, current: total }, context);
progress({ state: BuilderProgressState.Stopped }, context);
Expand Down

0 comments on commit e3e7877

Please sign in to comment.