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

Function normalizeError

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

* Converts an unknown rejection reason to an Error-compatible value. * @param error - The rejected value. * @returns The existing error-like value, or an Error wrapping the rejection.

(error: unknown)

Source from the content-addressed store, hash-verified

128 * @returns The existing error-like value, or an Error wrapping the rejection.
129 */
130function normalizeError(error: unknown): Error {
131 if (isErrorLike(error)) {
132 return error
133 }
134
135 return new Error(String(error), { cause: error })
136}
137
138/**
139 * Checks whether a value provides the name and message of an Error.

Callers 1

toResourceFunction · 0.85

Calls 1

isErrorLikeFunction · 0.85

Tested by

no test coverage detected