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

Commita08956f

Browse files
committed
Show network error on unexpected disconnect
1 parent6316e07 commita08956f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

‎cmd/coder/shell.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ func runCommand(ctx context.Context, envName string, command string, args []stri
126126
Env:cmdEnv,
127127
})
128128
iferr!=nil {
129+
varcloseErr websocket.CloseError
130+
ifxerrors.As(err,&closeErr) {
131+
returnxerrors.Errorf("network error, is %q online?",envName)
132+
}
129133
returnerr
130134
}
131135

@@ -157,10 +161,14 @@ func runCommand(ctx context.Context, envName string, command string, args []stri
157161
}
158162
}()
159163
err=process.Wait()
160-
iferr!=nil&&xerrors.Is(err,ctx.Err()) {
161-
returnxerrors.Errorf("network error, is %q online?",envName)
164+
iferr!=nil {
165+
varcloseErr websocket.CloseError
166+
ifxerrors.Is(err,ctx.Err())||xerrors.As(err,&closeErr) {
167+
returnxerrors.Errorf("network error, is %q online?",envName)
168+
}
169+
returnerr
162170
}
163-
returnerr
171+
returnnil
164172
}
165173

166174
funcheartbeat(ctx context.Context,c*websocket.Conn,interval time.Duration) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp