Skip to content

Commit

Permalink
feat: refactor retryable and refresh token retries
Browse files Browse the repository at this point in the history
  • Loading branch information
hf committed Aug 30, 2023
1 parent 22923e7 commit 84d5b47
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,17 @@ export function retryable<T>(
return
}
} catch (e: any) {
if (!isRetryable(attempt, e)) {
reject(e)
let shouldRetry = false

try {
shouldRetry = isRetryable(attempt, e)
} catch (innerError: any) {
reject(innerError)
return
}

if (!shouldRetry) {
reject(error)
return
}
}
Expand Down

0 comments on commit 84d5b47

Please sign in to comment.