Skip to content

Commit c5cc601

Browse files
authored
Merge pull request #3 from Zee-Khan/master
Update delete_backup to check for error response
2 parents bc2175c + df638be commit c5cc601

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

internal/appcloud/delete_backup.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ func (p *Plugin) DeleteBackup(c plugin.CliConnection, serviceInstanceName string
3131
}
3232

3333
resString := strings.Join(resLines, "")
34-
var res ServerResponseError
35-
err = json.Unmarshal([]byte(resString), &res)
36-
if err != nil {
37-
return errors.Wrap(err, "Couldn't read JSON response from server")
38-
}
39-
40-
if res.ErrorCode != "" {
41-
return fmt.Errorf("Error response from server: %s", res.Description)
34+
if resString != "" {
35+
var res ServerResponseError
36+
err = json.Unmarshal([]byte(resString), &res)
37+
if err != nil {
38+
return errors.Wrap(err, "Couldn't read JSON response from server")
39+
}
40+
41+
if res.ErrorCode != "" {
42+
return fmt.Errorf("Error response from server: %s", res.Description)
43+
}
4244
}
4345

4446
p.ui.Say(terminal.SuccessColor("OK\n"))

0 commit comments

Comments
 (0)