mirror of
https://github.com/sot-tech/mochi.git
synced 2026-05-08 05:09:09 -07:00
Don't return an HTTP error for "bad request" tracker errors
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/chihaya/chihaya/config"
|
||||
"github.com/chihaya/chihaya/stats"
|
||||
"github.com/chihaya/chihaya/tracker"
|
||||
"github.com/chihaya/chihaya/tracker/models"
|
||||
)
|
||||
|
||||
type ResponseHandler func(http.ResponseWriter, *http.Request, httprouter.Params) (int, error)
|
||||
@@ -33,7 +34,7 @@ func makeHandler(handler ResponseHandler) httprouter.Handle {
|
||||
httpCode, err := handler(w, r, p)
|
||||
stats.RecordEvent(stats.HandledRequest)
|
||||
|
||||
if err != nil {
|
||||
if err != nil && err != models.ErrBadRequest {
|
||||
stats.RecordEvent(stats.ErroredRequest)
|
||||
http.Error(w, err.Error(), httpCode)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user