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

(cherry picked from commit 8fd3e9f)
  • Loading branch information
alan-agius4 committed Jul 28, 2022
1 parent 4ee825b commit eed54b3
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
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 eed54b3

Please sign in to comment.