mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-14 16:07:42 +00:00
more logging
This commit is contained in:
parent
05cb97d412
commit
d5affe36c1
3 changed files with 3 additions and 1 deletions
|
@ -115,6 +115,7 @@ func (a *api) createWatcherHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch err {
|
switch err {
|
||||||
case reddit.ErrSubredditIsPrivate, reddit.ErrSubredditIsQuarantined:
|
case reddit.ErrSubredditIsPrivate, reddit.ErrSubredditIsQuarantined:
|
||||||
|
err = fmt.Errorf("error watching %s: %w", cwr.Subreddit, err)
|
||||||
a.errorResponse(w, r, 403, err)
|
a.errorResponse(w, r, 403, err)
|
||||||
default:
|
default:
|
||||||
a.errorResponse(w, r, 422, err)
|
a.errorResponse(w, r, 422, err)
|
||||||
|
|
|
@ -170,7 +170,7 @@ func NewSubredditResponse(val *fastjson.Value) interface{} {
|
||||||
data := val.Get("data")
|
data := val.Get("data")
|
||||||
sr.ID = string(data.GetStringBytes("id"))
|
sr.ID = string(data.GetStringBytes("id"))
|
||||||
sr.Name = string(data.GetStringBytes("display_name"))
|
sr.Name = string(data.GetStringBytes("display_name"))
|
||||||
sr.Quarantined = data.GetBool("quarantined")
|
sr.Quarantined = data.GetBool("quarantine")
|
||||||
|
|
||||||
return sr
|
return sr
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,6 +136,7 @@ func TestSubredditResponseParsing(t *testing.T) {
|
||||||
assert.Equal(t, "t5", s.Kind)
|
assert.Equal(t, "t5", s.Kind)
|
||||||
assert.Equal(t, "2vq0w", s.ID)
|
assert.Equal(t, "2vq0w", s.ID)
|
||||||
assert.Equal(t, "DestinyTheGame", s.Name)
|
assert.Equal(t, "DestinyTheGame", s.Name)
|
||||||
|
assert.Equal(t, false, s.Quarantined)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUserResponseParsing(t *testing.T) {
|
func TestUserResponseParsing(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue