---
url: https://haihv.github.io/valifetch/api/index/type-aliases/RetryContext.md
---

# Type Alias: RetryContext

> **RetryContext** = `object` & ({ `error?`: `undefined`; `reason`: `"status"`; `response`: `Response`; } | { `error`: `Error`; `reason`: `"network"`; `response?`: `undefined`; })

Defined in: [src/types/options.ts:42](https://github.com/haihv/valifetch/blob/285835d38a6676b98d2ee1a93e23166c6c834cb2/src/types/options.ts#L42)

Context passed to `RetryOptions.shouldRetry` — the failure that may be retried.
Exactly one of `response` / `error` is set, discriminated by `reason`.

## Type Declaration

### request

> **request**: `Request`

The request that failed (the template that will be re-sent)

### retryCount

> **retryCount**: `number`

1-based number of the retry being considered (`1` = first retry)
