Skip to content

Return 404 instead of 500 on missing marker_preview (#847)#932

Closed
vjpixel wants to merge 1 commit intodevelopfrom
claude/fix-847-marker-preview-404
Closed

Return 404 instead of 500 on missing marker_preview (#847)#932
vjpixel wants to merge 1 commit intodevelopfrom
claude/fix-847-marker-preview-404

Conversation

@vjpixel
Copy link
Copy Markdown
Member

@vjpixel vjpixel commented Apr 25, 2026

marker_preview fetched Marker.objects.get(id=marker_id) directly, so an invalid or missing id raised DoesNotExist/ValueError through to a 500. Switch to the already-imported get_object_or_404. Pablo: LGTM.

Closes #847

https://claude.ai/code/session_01XC1THLWgnGXGf5wgRhdyvB


Generated by Claude Code

marker_preview fetched Marker.objects.get(id=marker_id) directly,
so an invalid or missing id raised DoesNotExist/ValueError through
to a 500. Switch to the already-imported get_object_or_404.

Closes #847

https://claude.ai/code/session_01XC1THLWgnGXGf5wgRhdyvB
Copy link
Copy Markdown
Member Author

vjpixel commented Apr 25, 2026

Self-review

Verdict: ✅

Marker.objects.get(id=marker_id)get_object_or_404(Marker, id=marker_id). Django 6's get_object_or_404 natively catches ValueError/TypeError/DoesNotExist, so missing/garbage ?id= values cleanly return 404 instead of 500.

vs duplicate #915: Functionally equivalent on Django 6. #915 adds an explicit int() coercion before the call — slightly more defensive (works on Django ≤ 4.0 and signals intent more clearly). Either approach works given the pinned Django 6 dependency.

Duplicate: #915.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

vjpixel commented Apr 25, 2026

Closing in favor of @SAY-5's #915 (same fix with explicit int coercion, slightly more defensive, opened first). See review there.


Generated by Claude Code

@vjpixel vjpixel closed this Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

marker_preview uses Marker.objects.get() without exception handling

2 participants