grpc send error via response instead of grpc error

This commit is contained in:
Chris Lu
2020-01-25 09:17:19 -08:00
parent 3f6e0e34cb
commit c48fc8b4de
14 changed files with 152 additions and 124 deletions

View File

@@ -1,6 +1,9 @@
package filer_pb
import (
"context"
"fmt"
"github.com/chrislusf/seaweedfs/weed/storage/needle"
)
@@ -67,3 +70,14 @@ func AfterEntryDeserialization(chunks []*FileChunk) {
}
}
func CreateEntry(ctx context.Context, client SeaweedFilerClient, request *CreateEntryRequest) error {
resp, err := client.CreateEntry(ctx, request)
if err == nil && resp.Error != "" {
return fmt.Errorf("CreateEntry: %v", resp.Error)
}
if err != nil {
return fmt.Errorf("CreateEntry: %v", err)
}
return err
}