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

# Type Alias: BeforeRetryHook

> **BeforeRetryHook** = (`state`) => `Request` | *typeof* [`stop`](../variables/stop.md) | `void` | `Promise`<`Request` | *typeof* [`stop`](../variables/stop.md) | `void`>

Defined in: [src/types/hooks.ts:52](https://github.com/haihv/valifetch/blob/285835d38a6676b98d2ee1a93e23166c6c834cb2/src/types/hooks.ts#L52)

Hook called before each retry is scheduled.
Return `stop` to abort retrying (the original failure is then handled as if
retries were exhausted), a `Request` to replace the request for subsequent
attempts, or nothing to leave the request unchanged.

## Parameters

### state

[`BeforeRetryState`](BeforeRetryState.md)

## Returns

`Request` | *typeof* [`stop`](../variables/stop.md) | `void` | `Promise`<`Request` | *typeof* [`stop`](../variables/stop.md) | `void`>
