diff --git a/client/user.go b/client/user.go index e80678ea..d6b262f7 100644 --- a/client/user.go +++ b/client/user.go @@ -3,6 +3,7 @@ package client import ( "fmt" "log" + "strings" ) type Credentials struct { @@ -263,10 +264,15 @@ func (client *Client) DeleteUser(userName string) error { Method: "DELETE", } - _, err := client.RequestAPI(&opts) - if err != nil { - return err - } + // 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" + res, err := client.RequestAPI(&opts) + if err != nil { + if !strings.Contains(string(res), "User does not exist") { + return err + } + } return nil }