fix: improve error messages for catalog download failures - #2561
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR improves catalog error diagnostics: exception logging in Catalog now includes the exception object and message; NetUtil gains a describeAuthMethod utility that identifies which authentication source (token, URL userinfo, .netrc, basic auth) applies to a URL; ImplicitCatalogRef uses it to warn about possibly expired credentials on download failure; new tests cover the utility. ChangesAuth-aware catalog download error reporting
Estimated code review effort: 2 (Simple) | ~12 minutes Possibly related issues
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
eec3c1c to
af6f002
Compare
- Warn when GITHUB_TOKEN is set and a GitHub catalog download fails, suggesting to update or unset the token - Log GITHUB_TOKEN usage at verbose level so users can see auth is being applied - Fix verboseMsg call in Catalog.findImportedCatalogsWith to pass the Throwable so --verbose actually prints stack traces Fixes #2559
Fixes #2559
When a catalog download fails and authentication was in play, users get an unhelpful "Unknown catalog" error with no clue that their token or credentials might be the problem.
What changed
NetUtil.describeAuthMethod(url)checks which auth method (if any) would apply for a given URL, using the same priority order asaddAuthHeaderIfNeeded:GITHUB_TOKEN,GITLAB_TOKEN, URL credentials,.netrc,JBANG_AUTH_BASIC_*. Returns a human-readable label or null.ImplicitCatalogRef.tryDownload()now callsdescribeAuthMethodon failure and warns when credentials were involved:This works for all auth methods, not just
GITHUB_TOKEN.Catalog.findImportedCatalogsWith()now passes both the exception message and the Throwable toverboseMsg, so the error reason is visible without--verboseand stack traces still print when verbose is on.Tests cover
.netrc, URL credentials, priority ordering, null returns for unmatched URLs, and invalid input.See #2560 for a follow-up to include attempted download URLs in the "Unknown catalog" error message itself.
Summary by CodeRabbit