Skip to content

Commit 0df359a

Browse files
committed
fix(@angular-devkit/build-angular): catch clause variable is not an Error instance
Errors thrown in RxJs are not instanceof Error and therefore the check will always fail. Closes angular#23631
1 parent b277a1a commit 0df359a

File tree

1 file changed

+5
-1
lines changed
  • packages/angular_devkit/build_angular/src/utils

1 file changed

+5
-1
lines changed

packages/angular_devkit/build_angular/src/utils/error.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@
99
import assert from 'assert';
1010

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

0 commit comments

Comments
 (0)