MCPcopy Index your code
hub / github.com/angular/angular-cli / isError

Function isError

packages/angular/cli/src/utilities/error.ts:22–27  ·  view source on GitHub ↗

* Checks if a given value is an Error-like object. * * This type guard checks if the value is an instance of `Error` or if it's an object * with `name` and `message` properties. This is useful for identifying error-like * objects that may not be direct instances of `Error` (e.g., from RxJs). *

(value: unknown)

Source from the content-addressed store, hash-verified

20 * @returns `true` if the value is an Error-like object, `false` otherwise.
21 */
22function isError(value: unknown): value is Error {
23 return (
24 value instanceof Error ||
25 (typeof value === 'object' && value !== null && 'name' in value && 'message' in value)
26 );
27}
28
29/**
30 * Asserts that a given value is an Error-like object.

Callers 1

assertIsErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected