Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/tunnel/connerror.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ func IsEOF(err error) bool {

func ClassifyTunnelErrors(tunnelErr, handlerErr error) error {
if handlerErr == nil {
if ClassifyError(tunnelErr) == ErrorPermanent {
return fmt.Errorf("agent command: %w", tunnelErr)
}
return nil
}
if IsEOF(handlerErr) {
Expand Down
5 changes: 4 additions & 1 deletion pkg/tunnel/connerror_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ func TestClassifyTunnelErrors(t *testing.T) {
wantNil bool
wantSubstr string
}{
{"handler nil", tunnelErr, nil, true, ""},
{"handler nil, no tunnel err", nil, nil, true, ""},
{"handler nil, permanent tunnel err", tunnelErr, nil, false, "agent command: dial failed"},
{"handler nil, shutdown tunnel err", context.Canceled, nil, true, ""},
{"handler nil, EOF tunnel err", io.EOF, nil, true, ""},
{"handler EOF with tunnel err", tunnelErr, io.EOF, false, "connect to server: dial failed"},
{"handler EOF no tunnel err", nil, io.EOF, true, ""},
{"handler non-EOF", nil, handlerNonEOF, false, "tunnel to container: handler broke"},
Expand Down
Loading