mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-08 00:24:23 +08:00
convert error fromating to %w everywhere (#6995)
This commit is contained in:
@@ -77,7 +77,7 @@ func StreamBfs(client SeaweedFilerClient, dir util.FullPath, olderThanTsNs int64
|
||||
Directory: string(dir),
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("traverse bfs metadata: %v", err)
|
||||
return fmt.Errorf("traverse bfs metadata: %w", err)
|
||||
}
|
||||
for {
|
||||
resp, err := stream.Recv()
|
||||
@@ -85,7 +85,7 @@ func StreamBfs(client SeaweedFilerClient, dir util.FullPath, olderThanTsNs int64
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
return fmt.Errorf("traverse bfs metadata: %v", err)
|
||||
return fmt.Errorf("traverse bfs metadata: %w", err)
|
||||
}
|
||||
if err := fn(util.FullPath(resp.Directory), resp.Entry); err != nil {
|
||||
return err
|
||||
|
@@ -112,7 +112,7 @@ func CreateEntry(ctx context.Context, client SeaweedFilerClient, request *Create
|
||||
resp, err := client.CreateEntry(ctx, request)
|
||||
if err != nil {
|
||||
glog.V(1).InfofCtx(ctx, "create entry %s/%s %v: %v", request.Directory, request.Entry.Name, request.OExcl, err)
|
||||
return fmt.Errorf("CreateEntry: %v", err)
|
||||
return fmt.Errorf("CreateEntry: %w", err)
|
||||
}
|
||||
if resp.Error != "" {
|
||||
glog.V(1).InfofCtx(ctx, "create entry %s/%s %v: %v", request.Directory, request.Entry.Name, request.OExcl, resp.Error)
|
||||
@@ -125,7 +125,7 @@ func UpdateEntry(ctx context.Context, client SeaweedFilerClient, request *Update
|
||||
_, err := client.UpdateEntry(ctx, request)
|
||||
if err != nil {
|
||||
glog.V(1).InfofCtx(ctx, "update entry %s/%s :%v", request.Directory, request.Entry.Name, err)
|
||||
return fmt.Errorf("UpdateEntry: %v", err)
|
||||
return fmt.Errorf("UpdateEntry: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -137,7 +137,7 @@ func LookupEntry(ctx context.Context, client SeaweedFilerClient, request *Lookup
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
glog.V(3).InfofCtx(ctx, "read %s/%v: %v", request.Directory, request.Name, err)
|
||||
return nil, fmt.Errorf("LookupEntry1: %v", err)
|
||||
return nil, fmt.Errorf("LookupEntry1: %w", err)
|
||||
}
|
||||
if resp.Entry == nil {
|
||||
return nil, ErrNotFound
|
||||
|
@@ -41,7 +41,7 @@ func FollowMetadata(filerAddress ServerAddress, grpcDialOption grpc.DialOption,
|
||||
|
||||
err := WithFilerClient(true, option.SelfSignature, filerAddress, grpcDialOption, makeSubscribeMetadataFunc(option, processEventFn))
|
||||
if err != nil {
|
||||
return fmt.Errorf("subscribing filer meta change: %v", err)
|
||||
return fmt.Errorf("subscribing filer meta change: %w", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -50,7 +50,7 @@ func WithFilerClientFollowMetadata(filerClient filer_pb.FilerClient, option *Met
|
||||
|
||||
err := filerClient.WithFilerClient(true, makeSubscribeMetadataFunc(option, processEventFn))
|
||||
if err != nil {
|
||||
return fmt.Errorf("subscribing filer meta change: %v", err)
|
||||
return fmt.Errorf("subscribing filer meta change: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -72,7 +72,7 @@ func makeSubscribeMetadataFunc(option *MetadataFollowOption, processEventFn Proc
|
||||
UntilNs: option.StopTsNs,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("subscribe: %v", err)
|
||||
return fmt.Errorf("subscribe: %w", err)
|
||||
}
|
||||
|
||||
for {
|
||||
|
@@ -200,7 +200,7 @@ func ParseServerAddress(server string, deltaPort int) (newServerAddress string,
|
||||
|
||||
host, port, parseErr := hostAndPort(server)
|
||||
if parseErr != nil {
|
||||
return "", fmt.Errorf("server port parse error: %v", parseErr)
|
||||
return "", fmt.Errorf("server port parse error: %w", parseErr)
|
||||
}
|
||||
|
||||
newPort := int(port) + deltaPort
|
||||
@@ -215,7 +215,7 @@ func hostAndPort(address string) (host string, port uint64, err error) {
|
||||
}
|
||||
port, err = strconv.ParseUint(address[colonIndex+1:], 10, 64)
|
||||
if err != nil {
|
||||
return "", 0, fmt.Errorf("server port parse error: %v", err)
|
||||
return "", 0, fmt.Errorf("server port parse error: %w", err)
|
||||
}
|
||||
|
||||
return address[:colonIndex], port, err
|
||||
|
Reference in New Issue
Block a user