From d5affe36c112baa876fb0d2a6a323125a8080611 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Thu, 30 Jun 2022 15:06:03 -0400 Subject: [PATCH] more logging --- internal/api/watcher.go | 1 + internal/reddit/types.go | 2 +- internal/reddit/types_test.go | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/api/watcher.go b/internal/api/watcher.go index f96e093..054769f 100644 --- a/internal/api/watcher.go +++ b/internal/api/watcher.go @@ -115,6 +115,7 @@ func (a *api) createWatcherHandler(w http.ResponseWriter, r *http.Request) { if err != nil { switch err { case reddit.ErrSubredditIsPrivate, reddit.ErrSubredditIsQuarantined: + err = fmt.Errorf("error watching %s: %w", cwr.Subreddit, err) a.errorResponse(w, r, 403, err) default: a.errorResponse(w, r, 422, err) diff --git a/internal/reddit/types.go b/internal/reddit/types.go index d092518..39c885d 100644 --- a/internal/reddit/types.go +++ b/internal/reddit/types.go @@ -170,7 +170,7 @@ func NewSubredditResponse(val *fastjson.Value) interface{} { data := val.Get("data") sr.ID = string(data.GetStringBytes("id")) sr.Name = string(data.GetStringBytes("display_name")) - sr.Quarantined = data.GetBool("quarantined") + sr.Quarantined = data.GetBool("quarantine") return sr } diff --git a/internal/reddit/types_test.go b/internal/reddit/types_test.go index 7396878..916cb56 100644 --- a/internal/reddit/types_test.go +++ b/internal/reddit/types_test.go @@ -136,6 +136,7 @@ func TestSubredditResponseParsing(t *testing.T) { assert.Equal(t, "t5", s.Kind) assert.Equal(t, "2vq0w", s.ID) assert.Equal(t, "DestinyTheGame", s.Name) + assert.Equal(t, false, s.Quarantined) } func TestUserResponseParsing(t *testing.T) {