Skip to content

Commit

Permalink
add error code reporting in the store command
Browse files Browse the repository at this point in the history
Signed-off-by: Boyang Lyu <boyangly@gmail.com>
  • Loading branch information
JackL9u committed Nov 7, 2024
1 parent b27f021 commit ae3d649
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/pd-ctl/pdctl/command/store_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"os"
"path"
"strconv"
"strings"
Expand Down Expand Up @@ -381,13 +382,15 @@ func deleteStoreCommandFunc(cmd *cobra.Command, args []string) {
func deleteStoreCommandByAddrFunc(cmd *cobra.Command, args []string) {
id := getStoreID(cmd, args, false)
if id == -1 {
os.Exit(1)
return
}
// delete store by its ID
prefix := fmt.Sprintf(storePrefix, id)
_, err := doRequest(cmd, prefix, http.MethodDelete, http.Header{})
if err != nil {
cmd.Printf("Failed to delete store %s: %s\n", args[0], err)
os.Exit(1)
return
}
cmd.Println("Success!")
Expand Down

0 comments on commit ae3d649

Please sign in to comment.