Skip to content

fix: return 404 for missing organizations - #2905

Open
mikemikimike wants to merge 1 commit into
helixml:mainfrom
mikemikimike:fix/organization-not-found-status
Open

fix: return 404 for missing organizations#2905
mikemikimike wants to merge 1 commit into
helixml:mainfrom
mikemikimike:fix/organization-not-found-status

Conversation

@mikemikimike

Copy link
Copy Markdown

Summary

  • map wrapped store.ErrNotFound errors from organization lookup to HTTP 404
  • preserve HTTP 500 for genuine store failures
  • add regression coverage for both status-code paths

Closes #2780

Why

lookupOrg preserves store.ErrNotFound with %w, but getOrganization previously mapped every lookup error to HTTP 500. Missing or deleted organizations are a normal not-found condition and should not be reported as server failures.

Tests

  • go test ./api/pkg/server -run '^TestGetOrganization_ErrorStatus$' -count=1
  • go test ./api/pkg/server -run '^Test(Get|Delete)Organization' -count=1
  • git diff --check

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.

GET /organizations/{id} returns 500 (not 404) for deleted/nonexistent org

1 participant