tianxiaoliang commented on a change in pull request #784:
URL: 
https://github.com/apache/servicecomb-service-center/pull/784#discussion_r544009862



##########
File path: server/resource/v4/role_resource.go
##########
@@ -68,21 +69,31 @@ func (r *RoleResource) GetRolePermission(w 
http.ResponseWriter, req *http.Reques
        controller.WriteJSON(w, b)
 }
 
-func (r *RoleResource) CreateRolePermission(w http.ResponseWriter, req 
*http.Request) {
+//RoleParse parse the role info from the request
+func (r *RoleResource) RoleParse(w http.ResponseWriter, req *http.Request) 
(*rbacframe.Role, bool) {
        body, err := ioutil.ReadAll(req.Body)
        if err != nil {
                log.Error("read body err", err)
                controller.WriteError(w, discovery.ErrInternal, err.Error())
-               return
+               return nil, false

Review comment:
       不要通过bool,而是err返回,然后通过err返回response,不要在下层调用controller.WriteError




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to