Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): catch clause variable is not an E…
Browse files Browse the repository at this point in the history
…rror instance

Errors thrown in RxJs are not instanceof Error and therefore the check will always fail.

Closes #23631
  • Loading branch information
alan-agius4 committed Jul 28, 2022
1 parent 44f9186 commit 8fd3e9f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/angular_devkit/build_angular/src/utils/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@
import assert from 'assert';

export function assertIsError(value: unknown): asserts value is Error & { code?: string } {
assert(value instanceof Error, 'catch clause variable is not an Error instance');
const isError =
value instanceof Error ||
// The following is needing to identify errors coming from RxJs.
(typeof value === 'object' && value && 'name' in value && 'message' in value);
assert(isError, 'catch clause variable is not an Error instance');
}

0 comments on commit 8fd3e9f

Please sign in to comment.