# Errors and Responses

This page explains how `IPGuardian.Check` behaves when Redis or a lookup fails, and the JSON body the middlewares return on rejection.

## Error-Handling Boundaries

| Case | Behavior |
|---|---|
| Allow/Deny Redis lookup fails | Falls back to the memory cache |
| Block Redis lookup fails | Treated as not blocked (fail-open) |
| Per-minute count fails | Count treated as `1` |

## Response Format

`Check` returns `IPGuardianResult`; both middlewares turn a failure into JSON:

```json
{"error": "Device is banned, IP: 198.51.100.77"}
```

To call `Check` yourself, see [Middleware](/middleware).

For the check order and rate-limit tiers, see [Request Lifecycle](/request-lifecycle).
