Commit 4969ada
committed
fix(api): catch DataError in /alerts/query to return 400 instead of 500
When a CEL filter contains a non-UUID value against a UUID-typed column,
PostgreSQL raises a DataError which was not caught — only CelToSqlException
was handled, so FastAPI returned a 500.
Add an explicit except DataError block that returns a 400 with a clear
message. This is a provider-agnostic safety net: any provider that stores
a non-UUID alert id would hit the same crash, regardless of fixes applied
at the provider level.
Related: keephq#6219 (fixes root cause in Prometheus provider).1 parent b2eabaf commit 4969ada
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
228 | 229 | | |
229 | 230 | | |
230 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
231 | 240 | | |
232 | 241 | | |
233 | 242 | | |
| |||
0 commit comments