From 00b1a396af5426ea079cacb5761f12648eaa85c5 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Thu, 9 Jun 2016 15:38:40 +0200 Subject: [PATCH] api: push silence validation into provider --- api.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/api.go b/api.go index eaf8fe5d..72bb388a 100644 --- a/api.go +++ b/api.go @@ -293,17 +293,6 @@ func (api *API) addSilence(w http.ResponseWriter, r *http.Request) { } sil := types.NewSilence(&msil) - // if sil.CreatedAt.IsZero() { - // sil.CreatedAt = time.Now() - // } - - if err := sil.Validate(); err != nil { - respondError(w, apiError{ - typ: errorBadData, - err: err, - }, nil) - return - } if err := sil.Init(); err != nil { respondError(w, apiError{ typ: errorBadData, @@ -430,7 +419,7 @@ func respondError(w http.ResponseWriter, apiErr apiError, data interface{}) { if err != nil { return } - log.Errorf("api error: %v", apiErr) + log.Errorf("api error: %s", apiErr) w.Write(b) }