agent: avoid masking errors when ACLs deny a request

This commit is contained in:
Ryan Uber 2015-06-18 17:34:35 -07:00
parent beb27fb3ef
commit 5bde81bcdc

View File

@ -62,10 +62,14 @@ func (s *HTTPServer) EventFire(resp http.ResponseWriter, req *http.Request) (int
// Try to fire the event // Try to fire the event
if err := s.agent.UserEvent(dc, token, event); err != nil { if err := s.agent.UserEvent(dc, token, event); err != nil {
if strings.Contains(err.Error(), permissionDenied) {
resp.WriteHeader(403) resp.WriteHeader(403)
resp.Write([]byte(permissionDenied)) resp.Write([]byte(permissionDenied))
return nil, nil return nil, nil
} }
resp.WriteHeader(500)
return nil, err
}
// Return the event // Return the event
return event, nil return event, nil