mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
error checking for remove
This commit is contained in:
parent
8d9a76005d
commit
712720864d
|
@ -2,6 +2,7 @@ package filer_pb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
|
@ -207,7 +208,7 @@ func MkFile(filerClient FilerClient, parentDirectoryPath string, fileName string
|
||||||
func Remove(filerClient FilerClient, parentDirectoryPath string, name string, isDeleteData, isRecursive, ignoreRecursiveErr bool) error {
|
func Remove(filerClient FilerClient, parentDirectoryPath string, name string, isDeleteData, isRecursive, ignoreRecursiveErr bool) error {
|
||||||
return filerClient.WithFilerClient(func(client SeaweedFilerClient) error {
|
return filerClient.WithFilerClient(func(client SeaweedFilerClient) error {
|
||||||
|
|
||||||
if _, err := client.DeleteEntry(context.Background(), &DeleteEntryRequest{
|
if resp, err := client.DeleteEntry(context.Background(), &DeleteEntryRequest{
|
||||||
Directory: parentDirectoryPath,
|
Directory: parentDirectoryPath,
|
||||||
Name: name,
|
Name: name,
|
||||||
IsDeleteData: isDeleteData,
|
IsDeleteData: isDeleteData,
|
||||||
|
@ -215,6 +216,10 @@ func Remove(filerClient FilerClient, parentDirectoryPath string, name string, is
|
||||||
IgnoreRecursiveError: ignoreRecursiveErr,
|
IgnoreRecursiveError: ignoreRecursiveErr,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
|
} else {
|
||||||
|
if resp.Error != "" {
|
||||||
|
return errors.New(resp.Error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue