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
1 changed files with 7 additions and 3 deletions

View File

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