> ## Documentation Index
> Fetch the complete documentation index at: https://acme-c84a37e5.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Best Practices

> Recommended patterns for retries, cancellation, and observability

## Reuse an instance

```typescript theme={null}
import tryo from "tryo";
export const runner = tryo({ ignoreAbort: true });
```

## Centralize `mapError`

```typescript theme={null}
const runner = tryo({ mapError: (e) => ({ ...e, message: e.message }) });
```

## Limit retries

```typescript theme={null}
await runner.run(() => fetch("/api"), {
  retries: 3,
  shouldRetry: (attempt, e, ctx) => e.code !== "ABORTED" && ctx.elapsedTime < 5000,
});
```

## Use jitter and backoff

```typescript theme={null}
await runner.run(() => fetch("/api"), { retryDelay: 300, jitter: 0.5, backoffStrategy: "exponential" });
```
