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) { ...@@ -265,10 +265,12 @@ func RemotPathExists(path string) (def.ErrCode, error) {
var dl SvrResp var dl SvrResp
json.Unmarshal(body, &dl) json.Unmarshal(body, &dl)
if dl.Msg == "user do not login" {
return def.ERR_NOT_LOGIN, nil
}
if dl.Msg != "OK" { if dl.Msg != "OK" {
return def.ERR_PATH_NOT_EXISTED, nil return def.ERR_PATH_NOT_EXISTED, nil
} }
return def.SUCCESS, nil return def.SUCCESS, nil
} }
......
...@@ -126,10 +126,15 @@ func main() { ...@@ -126,10 +126,15 @@ func main() {
nodetree.StrDst = "data" + nodetree.StrDst nodetree.StrDst = "data" + nodetree.StrDst
remot_dst, err := httpcli.RemotPathExists(nodetree.StrDst) remot_dst, err := httpcli.RemotPathExists(nodetree.StrDst)
if err != nil { if err != nil {
fmt.Println(err)
return
}
if remot_dst == def.ERR_NOT_LOGIN {
fmt.Println("invalid token")
return return
} }
if remot_dst == def.ERR_PATH_NOT_EXISTED { 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 return
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!