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