Programming concepts

Retry eligibility

Try the free JavaScript compiler

A bounded application-specific decision; retry eligibility also depends on method, cancellation and server contract.

Formal Syntax & Structure

javascript syntaxjavascript
attempt < max && retryableStatuses.includes(status)

Return Value

boolean

Whether this example policy permits another attempt.

Working Example

Example Snippetjavascript
(async () => {const eligible=(status,attempt)=>attempt<3&&[429,503].includes(status);console.log(eligible(503,2),eligible(404,1),eligible(429,3));})()
JavaScript Reference