Commit fb7d7dec by shenyizhong

* code review

1 parent 41f20bde
Showing with 9 additions and 2 deletions
......@@ -265,10 +265,12 @@ func RemotPathExists(path string) (def.ErrCode, error) {
var dl SvrResp
json.Unmarshal(body, &dl)
if dl.Msg == "user do not login" {
return def.ERR_NOT_LOGIN, nil
}
if dl.Msg != "OK" {
return def.ERR_PATH_NOT_EXISTED, nil
}
return def.SUCCESS, nil
}
......
......@@ -126,10 +126,15 @@ func main() {
nodetree.StrDst = "data" + nodetree.StrDst
remot_dst, err := httpcli.RemotPathExists(nodetree.StrDst)
if err != nil {
fmt.Println(err)
return
}
if remot_dst == def.ERR_NOT_LOGIN {
fmt.Println("invalid token")
return
}
if remot_dst == def.ERR_PATH_NOT_EXISTED {
fmt.Printf("target path not exist on server\n")
fmt.Println("target path not exist on server")
return
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!