Commit 6c690af
[FIX] Surface non_field_errors and name resources in 404s in the central DRF error path (#2099)
* [FIX] Surface non_field_errors as a toast instead of failing silently
When a form passes setBackendErrors, useExceptionHandler routed validation
errors to inline field rendering only and returned no alert. Errors whose
attr is non_field_errors (or has no attr) map to no input field, and
getBackendErrorDetail matches errors by attr, so these were never rendered
anywhere -> the request appeared to silently succeed.
This surfaced after the DRF 3.15 bump, where duplicate-create errors arrive
as nested non_field_errors ("...must make a unique set") instead of a
top-level detail string. Affected user-visible flows include duplicate LLM
profile name and table settings save.
Keep inline field errors as-is; additionally collect any non-field/attr-less
errors and show them in a toast. The toast relays only the backend-provided
detail (not the attr label), so nothing beyond the message itself is exposed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G8hAHc4HUo42zY1g9LAjKu
* [FIX] Address review: guard non-array errors, use bullet separator
- Array.isArray guard before filter (avoids throw on non-array error payload)
- Join multiple non-field messages with bullet, matching the other branch
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G8hAHc4HUo42zY1g9LAjKu
* [MISC] Tighten non-field-error comments to concise WHY-only
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G8hAHc4HUo42zY1g9LAjKu
* [FIX] Name the resource in DRF 404s via verbose_name
DRF returns a bare "Not found." for every 404 across all apps, giving
users no context. Enrich the detail in the central exception handler
using the view's queryset model `verbose_name`, so 404s read
"<Resource> not found." app-wide with no per-view work. Models can tune
their label via `Meta.verbose_name`; views without a static `queryset`
keep the generic message.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X8t7DFHq7Dj655kEywKk3K
* [FIX] Drop DEBUG=True from test settings (SonarCloud S4507)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X8t7DFHq7Dj655kEywKk3K
* [FIX] Guard non-dict error items in 404 enrichment (CodeRabbit)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X8t7DFHq7Dj655kEywKk3K
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 550f9e5 commit 6c690af
3 files changed
Lines changed: 104 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
56 | 81 | | |
57 | 82 | | |
58 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
51 | 63 | | |
52 | 64 | | |
53 | 65 | | |
| |||
0 commit comments