Github user alficles commented on a diff in the pull request:

    
https://github.com/apache/incubator-trafficcontrol/pull/425#discussion_r111799324
  
    --- Diff: traffic_monitor_golang/traffic_monitor/datareq/datareq.go ---
    @@ -157,16 +159,34 @@ func WrapErrCode(errorCount threadsafe.Uint, reqPath 
string, body []byte, err er
     // WrapBytes takes a function which cannot error and returns only bytes, 
and wraps it as a http.HandlerFunc. The errContext is logged if the write 
fails, and should be enough information to trace the problem (function name, 
endpoint, request parameters, etc).
     func WrapBytes(f func() []byte, contentType string) http.HandlerFunc {
        return func(w http.ResponseWriter, r *http.Request) {
    +           bytes := f()
    +           bytes, err := gzipIfAccepts(r, w, bytes)
    +           if err != nil {
    --- End diff --
    
    Shouldn't this error be handled the same as others? I think it should 
increment errorCount, like all the other routines, right?
    
    And if it's doing that, why wouldn't it just be a wrapper around WrapErr, 
which contrary to the indication one might glean from it's name is just the 
same as this, but with errors as well. In fact, this function might could be 
written:
    
        return WrapErr( errorCode /* that probably needs to be passed in */,
            func() ([]byte, err) { return f(), nil },
            contentType)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to