Skip to content

fix: improve CDC error handling to distinguish user-not-found from connection errors#4991

Open
Varsha0506 wants to merge 1 commit into
devfrom
feature#cdc-error-handling
Open

fix: improve CDC error handling to distinguish user-not-found from connection errors#4991
Varsha0506 wants to merge 1 commit into
devfrom
feature#cdc-error-handling

Conversation

@Varsha0506

@Varsha0506 Varsha0506 commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes misleading "User didn't log in to CDC" error that appeared even when the user was logged into the CDC portal. The root cause was OpenMetadataClient.getUserByFqn() catching all exceptions as EntityNotFoundException, meaning network timeouts, auth failures, or any OpenMetadata API error was misreported as "user not found."

Changes across 3 files:

  • OpenMetadataClient.java: Split the catch-all Exception handler into FeignException.NotFound (actual 404 → EntityNotFoundException) vs all other exceptions (→ OpenMetadataClientException with original error preserved).
  • FabricCatalogManagementController.java: Added OpenMetadataClientException catch block in both publishCatalogRequest and updatePublishedCatalogRequest, returning HTTP 500 with an accurate "unable to connect to CDC" message. Updated EntityNotFoundException handler to include the user ID in the message. Also fixed copy-paste issue in updatePublishedCatalogRequest where error messages and logs incorrectly said "publish" instead of "update."
  • CdcPush.js: Frontend now displays the actual backend error message instead of a hardcoded "User didn't log in to CDC" string for all 400 responses.

Review & Testing Checklist for Human

  • Verify FeignException.NotFound is the correct exception type for 404 responses from the OpenMetadata Feign client. If the client wraps this differently, the fix will misclassify real "not found" errors as connection errors. Check imports and the Feign client configuration.
  • Check BaseFabricCatalogManagementService.validateAndProcessOwners() — it also calls getUserByFqn() and catches EntityNotFoundException. With this change, non-404 errors will now throw OpenMetadataClientException instead, which is not caught in that method. Verify this won't cause unhandled exceptions.
  • Review error message content sent to frontend — the OpenMetadataClientException handler includes e.getMessage() in the HTTP response body. Confirm this doesn't leak sensitive internal details (hostnames, ports, stack traces) to end users.
  • Test end-to-end: Log into CDC, attempt a catalog publish from the portal, and verify the correct error/success message appears. Also test with CDC down/unreachable to confirm the new "unable to connect" path works.

Notes

  • No unit tests were added. Consider adding tests for getUserByFqn to cover both the 404 and non-404 exception paths.
  • The Java changes were not compiled locally (no local Gradle build environment). CI should catch compilation issues but watch for it.

…nnection errors

- OpenMetadataClient.getUserByFqn: catch FeignException.NotFound specifically
  for actual 404 (user not found), re-throw other exceptions as
  OpenMetadataClientException with original error details
- FabricCatalogManagementController: add OpenMetadataClientException handler
  in both publishCatalogRequest and updatePublishedCatalogRequest to return
  accurate error messages (connection/auth issues vs user not found)
- CdcPush.js: display actual backend error message instead of hardcoded
  'User didn't log in to CDC' for all 400 responses

Co-Authored-By: deloitte.supriya <deloitte.supriya@mercedes-benz.com>
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