We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 2a435e4 + 0d696c4 commit 6225574Copy full SHA for 6225574
client/user.go
@@ -3,6 +3,7 @@ package client
3
import (
4
"fmt"
5
"log"
6
+ "strings"
7
)
8
9
type Credentials struct {
@@ -263,10 +264,15 @@ func (client *Client) DeleteUser(userName string) error {
263
264
Method: "DELETE",
265
}
266
- _, err := client.RequestAPI(&opts)
267
- if err != nil {
268
- return err
269
- }
+ // The API will return a 500 error if the user cannot be found
+ // In this case the DeleteUser function should not return an error.
+ // Return error only if the body of the return message does not contain "User does not exist"
270
+ res, err := client.RequestAPI(&opts)
271
+ if err != nil {
272
+ if !strings.Contains(string(res), "User does not exist") {
273
+ return err
274
+ }
275
276
277
return nil
278
0 commit comments