8000 fix(cli): handle nil unwrap errors when formatting (cherry-pick #18099) by gcp-cherry-pick-bot[bot] · Pull Request #18821 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

fix(cli): handle nil unwrap errors when formatting (cherry-pick #18099) #18821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2025

Conversation

gcp-cherry-pick-bot[bot]
Copy link

Cherry-picked fix(cli): handle nil unwrap errors when formatting (#18099)

Discovered an unhelpful error when running a CLI command without internet (I didn't know I didn't have internet!):

$ coder ls
Encountered an error running "coder list", see "coder list --help" for more information
error: <nil>

The source of this was that calling Unwrap() on net.DNSError can return nil, causing the whole error trace to get replaced by it. Instead, we'll just treat a nil Unwrap() return value as if there was nothing to unwrap.

The result is:

$ coder ls
Encountered an error running "coder list", see "coder list --help" for more information
error: query workspaces: Get "https://dev.coder.com/api/v2/workspaces?q=owner%3Ame": dial tcp: lookup dev.coder.com: no such host

Discovered an unhelpful error when running a CLI command without internet (I didn't know I didn't have internet!):

```
$ coder ls
Encountered an error running "coder list", see "coder list --help" for more information
error: <nil>
```

The source of this was that calling `Unwrap()` on `net.DNSError` can return nil, causing the whole error trace to get replaced by it. Instead, we'll just treat a nil `Unwrap()` return value as if there was nothing to unwrap.

The result is:
```
$ coder ls
Encountered an error running "coder list", see "coder list --help" for more information
error: query workspaces: Get "https://dev.coder.com/api/v2/workspaces?q=owner%3Ame": dial tcp: lookup dev.coder.com: no such host
```
@matifali matifali merged commit a7f0dba into release/2.23 Jul 10, 2025
41 checks passed
@matifali matifali deleted the cherry-pick-d0355e-release/2.23 branch July 10, 2025 05:43
@github-actions github-actions bot locked and limited conversation to collaborators Jul 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0