Skip to content

EPMDEDP-16620: fix: Add proper 404/401 error handling#62

Merged
SergK merged 1 commit into
mainfrom
fix-404-error-masking
Mar 28, 2026
Merged

EPMDEDP-16620: fix: Add proper 404/401 error handling#62
SergK merged 1 commit into
mainfrom
fix-404-error-masking

Conversation

@SergK
Copy link
Copy Markdown
Member

@SergK SergK commented Mar 28, 2026

Extract classifyGitHubError helper to centralize GitHub error mapping. Extract isBitbucketNotFound helper for type-safe 404 detection.

Add 404→ErrNotFound and 401→ErrUnauthorized mappings to all providers so errors are properly wrapped as domain sentinels instead of raw API errors. This ensures API handlers can correctly map to HTTP status codes.

Add 403 (Forbidden) checks to GitLab methods for token scope errors. Fix Bitbucket GetRepository to use typed error helper instead of fragile string comparison.

Remove misleading ErrNotFound mapping from ListUserOrganizations since GET /groups never returns 404 in normal operation.

Add comprehensive test coverage for 404/401 scenarios across all providers.

@SergK SergK requested a review from a team as a code owner March 28, 2026 14:16
@SergK SergK force-pushed the fix-404-error-masking branch 2 times, most recently from a7c2a6d to 3f956d3 Compare March 28, 2026 14:33
@SergK SergK changed the title EPMDEDP-16620: fix: Add proper 404/401 error handling across git providers EPMDEDP-16620: fix: Add proper 404/401 error handling Mar 28, 2026
Extract classifyGitHubError helper to centralize GitHub error mapping.
Extract isBitbucketNotFound helper for type-safe 404 detection.

Add 404>ErrNotFound and 401>ErrUnauthorized mappings to all providers so
errors are properly wrapped as domain sentinels instead of raw API errors.
This ensures API handlers can correctly map to HTTP status codes.

Add 403 (Forbidden) checks to GitLab methods for token scope errors.
Fix Bitbucket GetRepository to use typed error helper instead of fragile
string comparison.

Remove misleading ErrNotFound mapping from ListUserOrganizations since
GET /groups never returns 404 in normal operation.

Add comprehensive test coverage for 404/401 scenarios across all providers.

Signed-off-by: Sergiy Kulanov <sergiy_kulanov@epam.com>
@SergK SergK force-pushed the fix-404-error-masking branch from 3f956d3 to f1c16d9 Compare March 28, 2026 14:42
@SergK SergK merged commit c40a2a9 into main Mar 28, 2026
2 checks passed
@SergK SergK deleted the fix-404-error-masking branch March 28, 2026 16:42
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.

1 participant