fix: friendly error message when api.ngc.nvidia.com is unreachable#367
Open
robobryce wants to merge 1 commit intobrevdev:mainfrom
Open
fix: friendly error message when api.ngc.nvidia.com is unreachable#367robobryce wants to merge 1 commit intobrevdev:mainfrom
robobryce wants to merge 1 commit intobrevdev:mainfrom
Conversation
Network failures (DNS timeout, dial refused) during login or token refresh used to surface a multi-line stack trace plus repeated resty WARN/ERROR blocks. Detect transport-level errors at the auth boundary and render them as a short, actionable message with a directive. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
|
@patelspratik I think this is a better user facing diagnostic, but not sure, thoughts? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #367 +/- ##
==========================================
+ Coverage 18.18% 18.72% +0.54%
==========================================
Files 140 140
Lines 18684 18763 +79
==========================================
+ Hits 3398 3514 +116
+ Misses 14912 14865 -47
- Partials 374 384 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WARN/ERRORblocks on the auth client unlessBREV_DEBUG_HTTPis set —cmderrorsalready prints a friendly user-facing message and the resty trace is just noise.Before
After
Implementation
pkg/errors/errors.go— newNetworkErrortype plusIsNetworkError,HostFromURLError,WrapNetworkErrorhelpers.pkg/auth/kas.go— wrapclient.Dofailures inMakeLoginCallandretrieveIDTokenwithWrapNetworkError, deriving the host fromBaseURL.pkg/cmd/cmderrors/cmderrors.go— handle*NetworkErrorin the type switch: render in yellow with directive, skip Sentry reporting.pkg/store/http.go— install a silent resty logger on the auth HTTP client when not in debug mode.Test plan
go test ./pkg/errors/...— 13 tests pass (table-drivenIsNetworkError, host extraction, wrap behavior, message content,Unwrap/errors.Ischain, realhttptest.Serverintegration,pkgerrors.Causesurvival throughWrapAndTrace).go test ./pkg/auth/...— 12 tests pass including newTestMakeLoginCall_NetworkError,TestRetrieveIDToken_NetworkError,TestRetrieveIDToken_NonNetworkErrorUnchanged, andTest_hostFromURL.go test ./pkg/cmd/cmderrors/...— captures stderr to assert friendly rendering with no[error]/github.com/brevdev/...lines, and that plain errors still render through.go test ./pkg/store/...andgo vet ./...clean across the entire module.🤖 Generated with Claude Code