geyanggang opened a new pull request, #14937: URL: https://github.com/apache/gravitino/pull/14937
### What changes were proposed in this pull request? - `CatalogManager.initCatalogWrapper` now passes `ForbiddenException` through unchanged, in addition to `IllegalArgumentException` and `ConnectionFailedException`, when a catalog's create-time validation throws it. - Add `testCreateCatalogPropagatesBackendForbidden`, with a `need-forbid` switch in the test catalog operations. The test checks that the exception is not wrapped and that the cache and the store are rolled back. ### Why are the changes needed? A backend that refuses the credentials configured for a catalog is a caller-side configuration problem. A catalog implementation can report it with `ForbiddenException`, and the catalog REST exception handler maps that to 403. But the exception was wrapped in a plain `RuntimeException` by the class loader passthrough, so creating the catalog returned 500. The only alternative for a catalog was `ConnectionFailedException` (502, "retry later"), which is wrong for a request that can never succeed. The standalone connection test already reports the same denial as 403. Only exceptions that were previously turned into a 500 change. 400 and 502 results and the failure cleanup are unchanged. Fixes #14936 ### Does this PR introduce _any_ user-facing change? Creating a catalog whose create-time validation throws `ForbiddenException` now returns 403 instead of 500. No API or property changes. ### How was this patch tested? - New unit test `TestCatalogManager#testCreateCatalogPropagatesBackendForbidden`. Without the fix it fails with `RuntimeException`. - `./gradlew :core:spotlessJavaCheck :core:javadoc :core:coreUnitTest --tests '*TestCatalogManager*' -PskipITs` passes (61 tests). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
