Skip to content

fix: propagate 404 status code instead of 500 for missing resources#579

Open
opyh wants to merge 10 commits intoproductionfrom
fix/propagate-404-status-code
Open

fix: propagate 404 status code instead of 500 for missing resources#579
opyh wants to merge 10 commits intoproductionfrom
fix/propagate-404-status-code

Conversation

@opyh
Copy link
Copy Markdown
Member

@opyh opyh commented Feb 11, 2026

Summary

Fix backend 404 errors being converted to 500 errors on the frontend.

Problem

When accessing a non-existent mapping event (e.g., /events/THIS_ID_DOES_NOT_EXIST), the backend correctly returns a 404, but the frontend was showing a 500 error.

Root Cause

The _app.tsx error handler already extracts error.status || error.statusCode || 500 to set the response status code, but ResponseError class didn't expose these properties. The error was caught, but since status/statusCode were undefined, it defaulted to 500.

Solution

Added status and statusCode getters to ResponseError class that return the HTTP status from the underlying response object.

Testing

  1. Start the dev server: npm run dev
  2. Visit http://localhost:3000/events/THIS_ID_DOES_NOT_EXIST
  3. Verify the response is 404 (not 500)
  4. curl -I http://localhost:3000/events/THIS_ID_DOES_NOT_EXIST should show HTTP/1.1 404

(Asana link)

@opyh opyh added the deploy Keep a test deployment running label Feb 11, 2026
opyh added 2 commits February 11, 2026 16:30
…pagation

The _app.tsx error handler already extracts error.status || error.statusCode,
but ResponseError didn't expose these properties. This caused all backend
errors (including 404) to be caught and converted to 500.

Now ResponseError exposes status/statusCode getters that return the
HTTP status from the underlying response, allowing 404s to propagate correctly.
@opyh opyh force-pushed the fix/propagate-404-status-code branch from abc236f to fba5a89 Compare February 11, 2026 15:32
@opyh opyh removed the deploy Keep a test deployment running label Apr 23, 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.

2 participants