Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

index.ts

16 lines390 Bytes

1/**
2 *
3 * @param throwError
4 * @param params
5 */
6export function shouldThrowError<T extends (...args: Array<any>) => boolean>(
7 throwError: boolean | T | undefined,
8 params: Parameters<T>,
9): boolean {
10 // Allow throwError function to override throwing behavior on a per-error basis
11 if (typeof throwError === 'function') {
12 return throwError(...params)
13 }
14​
15 return !!throwError