Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commit155fa2b

Browse files
committed
Improve environment not found error message
1 parent3bee6d0 commit155fa2b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

‎internal/cmd/ceapi.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"context"
5+
"fmt"
56

67
"cdr.dev/coder-cli/coder-sdk"
78
"golang.org/x/xerrors"
@@ -72,5 +73,17 @@ func findEnv(ctx context.Context, client *coder.Client, envName, userEmail strin
7273
found=append(found,env.Name)
7374
}
7475

75-
returnnil,coder.ErrNotFound
76+
returnnil,notFoundButDidFind{
77+
needle:envName,
78+
haystack:found,
79+
}
80+
}
81+
82+
typenotFoundButDidFindstruct {
83+
needlestring
84+
haystack []string
85+
}
86+
87+
func (nnotFoundButDidFind)Error()string {
88+
returnfmt.Sprintf("\"%s\" not found in %q: %v",n.needle,n.haystack,coder.ErrNotFound)
7689
}

‎internal/cmd/shell.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func runCommand(ctx context.Context, envName, command string, args []string) err
153153
iferr!=nil {
154154
varcloseErr websocket.CloseError
155155
ifxerrors.As(err,&closeErr) {
156-
returnxerrors.Errorf("network error, is %q online? (%w)",envName,err)
156+
returnxerrors.Errorf("network error, is %q online?",envName)
157157
}
158158
returnxerrors.Errorf("start remote command: %w",err)
159159
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp