Open History to see the last commit
1export function shouldThrowError<T extends (...args: any[]) => boolean>(
2 suspense: boolean | undefined,
3 _useErrorBoundary: boolean | T | undefined,
4 params: Parameters<T>
5): boolean {
6 // Allow useErrorBoundary function to override throwing behavior on a per-error basis
7 if (typeof _useErrorBoundary === 'function') {
8 return _useErrorBoundary(...params)
9 }
10β
11 // Allow useErrorBoundary to override suspense's throwing behavior
12 if (typeof _useErrorBoundary === 'boolean') return _useErrorBoundary
13β
14 // If suspense is enabled default to throwing errors
15 return !!suspense
16}