Errors and Responses
Last updated
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 |
|---|---|
| Redis fails during scoring | dynamicScore returns nil plus an error; Check only logs it, then reads score.IsBlock and panics with a nil pointer dereference; see Known Issues |
| 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:
{"error": "Device is banned, IP: 198.51.100.77"}
To call Check yourself, see Middleware.
For the check order and rate-limit tiers, see Request Lifecycle.