APP-2997: Handle age assurance data load failures (#11612)
Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import {isRetryableRequestError} from '#/lib/async/retry'
|
||||
|
||||
describe('retry', () => {
|
||||
it('identifies retryable request errors', () => {
|
||||
expect(isRetryableRequestError(new TypeError('Failed to fetch'))).toBe(true)
|
||||
expect(isRetryableRequestError(new Error('Invalid request'))).toBe(false)
|
||||
})
|
||||
})
|
||||
@@ -1,5 +1,9 @@
|
||||
import {timeout} from '#/lib/async/timeout'
|
||||
import {isNetworkError} from '#/lib/strings/errors'
|
||||
import {isNetworkError, shouldRetryError} from '#/lib/strings/errors'
|
||||
|
||||
export function isRetryableRequestError(error: unknown) {
|
||||
return isNetworkError(error) || shouldRetryError(error)
|
||||
}
|
||||
|
||||
export async function retry<P>(
|
||||
retries: number,
|
||||
|
||||
Reference in New Issue
Block a user