| 108 | // (A shared `classifyDurableObjectError` would be the right home for this once |
| 109 | // one exists.) |
| 110 | const counterErrorCode = (reason: string): RateLimitCounterErrorCode => { |
| 111 | if (/caused object to be reset/i.test(reason)) return "storage_reset"; |
| 112 | if (/overloaded/i.test(reason)) return "overloaded"; |
| 113 | if (/exceeded (its )?memory|out of memory/i.test(reason)) return "exceeded_memory"; |
| 114 | if (/network connection lost|connection.*(lost|reset)/i.test(reason)) return "network"; |
| 115 | return "unknown"; |
| 116 | }; |
| 117 | |
| 118 | /** |
| 119 | * The fail-open landing: record the outcome on the check span, warn, and allow |