MCPcopy Create free account
hub / github.com/TanStack/query / isErrorLike

Function isErrorLike

packages/angular-query/src/query-resource.ts:143–151  ·  view source on GitHub ↗

* Checks whether a value provides the name and message of an Error. * @param error - The value to inspect. * @returns Whether the value can be used as an Error.

(error: unknown)

Source from the content-addressed store, hash-verified

141 * @returns Whether the value can be used as an Error.
142 */
143function isErrorLike(error: unknown): error is Error {
144 return (
145 error instanceof Error ||
146 (typeof error === 'object' &&
147 error !== null &&
148 typeof (error as Error).name === 'string' &&
149 typeof (error as Error).message === 'string')
150 )
151}

Callers 1

normalizeErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected