wilfred-s commented on a change in pull request #186:
URL: 
https://github.com/apache/incubator-yunikorn-core/pull/186#discussion_r462881322



##########
File path: pkg/webservice/handlers.go
##########
@@ -98,6 +107,20 @@ func getApplicationsInfo(w http.ResponseWriter, r 
*http.Request) {
        }
 }
 
+func validateQueue(queueName string) error {
+       if queueName != "" {
+               queueNameArr := strings.Split(queueName, ".")
+               for _, name := range queueNameArr {
+                       if !configs.QueueNameRegExp.MatchString(name) {
+                               return errors.New("Problem in Queue query 
parameter parsing as queue param '" + queueName + "' " +
+                                       "contains invalid queue name '" + name 
+ "'. Queue name must only have alphanumeric characters," +
+                                       " - or _, and be no longer than 64 
characters.")

Review comment:
       I would recommend that you generate a new error using `fmt.Errorf()`
   In the case that there is just a fixed string you can use `errors.New()` 
when using a complex construct like you do in this case using `fmt.Errorf()` is 
far more appropriate and improves readability of the code.




----------------------------------------------------------------
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