mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-24 04:37:43 +00:00
check err on subreddit watcher too
This commit is contained in:
parent
00f17b7622
commit
eb7ab043ed
1 changed files with 4 additions and 0 deletions
|
@ -115,6 +115,10 @@ func (a *api) createWatcherHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if cwr.Type == "subreddit" || cwr.Type == "trending" {
|
if cwr.Type == "subreddit" || cwr.Type == "trending" {
|
||||||
ac := a.reddit.NewAuthenticatedClient(account.AccountID, account.RefreshToken, account.AccessToken)
|
ac := a.reddit.NewAuthenticatedClient(account.AccountID, account.RefreshToken, account.AccessToken)
|
||||||
srr, err := ac.SubredditAbout(ctx, cwr.Subreddit)
|
srr, err := ac.SubredditAbout(ctx, cwr.Subreddit)
|
||||||
|
if err != nil {
|
||||||
|
a.errorResponse(w, r, 500, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
if !srr.Public {
|
if !srr.Public {
|
||||||
a.errorResponse(w, r, 403, reddit.ErrSubredditIsPrivate)
|
a.errorResponse(w, r, 403, reddit.ErrSubredditIsPrivate)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue