Implement RequestsHandled and RequestsErrored stats

This commit is contained in:
Justin Li 2014-07-22 01:40:52 -04:00
parent 6fdb68d9b2
commit 38d2c91ff1

View file

@ -31,7 +31,10 @@ func makeHandler(handler ResponseHandler) httprouter.Handle {
start := time.Now()
httpCode, err := handler(w, r, p)
stats.RecordEvent(stats.HandledRequest)
if err != nil {
stats.RecordEvent(stats.ErroredRequest)
http.Error(w, err.Error(), httpCode)
}