Skip to content

Commit 243fcc3

Browse files
authored
fix Backup() returning nil instead of error (#715)
1 parent 7dbd60b commit 243fcc3

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

topaz/clients/directory/backup.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (c *Client) Backup(ctx context.Context, file string) error {
4646

4747
tf, err := os.Create(file)
4848
if err != nil {
49-
return nil
49+
return err
5050
}
5151

5252
defer func() {
@@ -55,7 +55,7 @@ func (c *Client) Backup(ctx context.Context, file string) error {
5555

5656
gw, err := gzip.NewWriterLevel(tf, gzip.BestCompression)
5757
if err != nil {
58-
return nil
58+
return err
5959
}
6060

6161
defer func() {
@@ -68,8 +68,13 @@ func (c *Client) Backup(ctx context.Context, file string) error {
6868
_ = tw.Close()
6969
}()
7070

71-
_ = addToArchive(tw, path.Join(dirPath, ObjectsFileName))
72-
_ = addToArchive(tw, path.Join(dirPath, RelationsFileName))
71+
if err := addToArchive(tw, path.Join(dirPath, ObjectsFileName)); err != nil {
72+
return err
73+
}
74+
75+
if err := addToArchive(tw, path.Join(dirPath, RelationsFileName)); err != nil {
76+
return err
77+
}
7378

7479
return nil
7580
}

0 commit comments

Comments
 (0)