codjust commented on a change in pull request #1022: Feature/chash key support 
more flexible ways
URL: https://github.com/apache/incubator-apisix/pull/1022#discussion_r363282685
 
 

 ##########
 File path: lua/apisix/admin/upstreams.lua
 ##########
 @@ -45,23 +98,17 @@ local function check_conf(id, conf, need_id)
     if need_id and conf.id and tostring(conf.id) ~= tostring(id) then
         return nil, {error_msg = "wrong upstream id"}
     end
-
     core.log.info("schema: ", core.json.delay_encode(core.schema.upstream))
     core.log.info("conf  : ", core.json.delay_encode(conf))
-    local ok, err = core.schema.check(core.schema.upstream, conf)
+    local ok, err = check_upstream_conf(conf)
     if not ok then
-        return nil, {error_msg = "invalid configuration: " .. err}
+        return nil, err
 
 Review comment:
   ```lua
   local function check_upstream_conf(conf)
       local ok, err = core.schema.check(core.schema.upstream, conf)
       if not ok then
           return false, {error_msg = "invalid configuration: " .. err}
       end
   ...
   ```
   I move to this function. May be `check_upstream_conf` function return error 
string is better,
   unified error handling for `check_conf` function.
   
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to