Skip to content

Commit ed8d312

Browse files
authored
chore(orch): simplify errors to make them group-able (#2353)
1 parent d0ac010 commit ed8d312

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

packages/orchestrator/pkg/nfsproxy/chroot/nfs.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,11 @@ func (h *NFSHandler) Mount(
119119
) (nfs.MountStatus, billy.Filesystem, []nfs.AuthFlavor) {
120120
fs, err := h.getChroot(ctx, conn.RemoteAddr(), request)
121121
if err != nil {
122+
sourceIP, _, _ := net.SplitHostPort(conn.RemoteAddr().String())
123+
122124
logger.L().Warn(ctx, "failed to get path",
123125
zap.String("request", string(request.Dirpath)),
126+
logger.WithSandboxIP(sourceIP),
124127
zap.Error(err))
125128

126129
return nfs.MountStatusErrAcces, mountFailedFS{}, nil

packages/orchestrator/pkg/sandbox/health.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package sandbox
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"io"
78
"net/http"
@@ -23,6 +24,10 @@ func (c *Checks) getHealth(ctx context.Context, timeout time.Duration) (bool, er
2324

2425
response, err := sandboxHttpClient.Do(request)
2526
if err != nil {
27+
if errors.Is(err, context.DeadlineExceeded) {
28+
return false, fmt.Errorf("health check timed out")
29+
}
30+
2631
return false, err
2732
}
2833
defer func() {

packages/orchestrator/pkg/sandbox/map.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (m *Map) GetByHostPort(hostPort string) (*Sandbox, error) {
101101
}
102102
}
103103

104-
return nil, fmt.Errorf("sandbox with address %s not found", hostPort)
104+
return nil, fmt.Errorf("sandbox not found")
105105
}
106106

107107
func (m *Map) Insert(ctx context.Context, sbx *Sandbox) {

0 commit comments

Comments
 (0)