Commit c91aaef
authored
fix: handle RateLimitBlockedException in ExceptionHandlers (#3472)
## Summary
- Add missing `@ExceptionHandler` for `RateLimitBlockedException` in
`ExceptionHandlers.kt`
- Returns HTTP 444 (no body), matching the existing behavior in
`GlobalIpRateLimitFilter` and `GlobalUserRateLimitFilter`
## Problem
The strike-based rate limiting (#3451, commit 68b5250) introduced
`RateLimitBlockedException` but only caught it in the global servlet
filters. When thrown from controller-level rate limiting (e.g. the
export endpoint's `checkPerUserRateLimit`), it bubbled up as an
unhandled exception — causing HTTP 500 errors and Sentry noise since Feb
6th.
## Test plan
- [ ] Verify export endpoint returns 444 instead of 500 for repeat rate
limit offenders
- [ ] Confirm no new Sentry errors for `RateLimitBlockedException`
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Improved handling of blocked rate-limit events so users receive a
clear status when limits are exceeded and related occurrences are logged
for better observability.
* **Tests**
* Made NDJSON error extraction in tests more resilient by scanning for
error messages instead of relying on a fixed position.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 0e68d32 commit c91aaef
2 files changed
Lines changed: 14 additions & 1 deletion
File tree
- backend/app/src/main/kotlin/io/tolgee
- ee/backend/tests/src/test/kotlin/io/tolgee/ee/selfHostedLimitsAndReporting
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
256 | 257 | | |
257 | 258 | | |
258 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
259 | 266 | | |
260 | 267 | | |
261 | 268 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
111 | 117 | | |
112 | 118 | | |
113 | 119 | | |
| |||
0 commit comments