subreddit: subreddit not registered message when subreddit not found

This commit is contained in:
Tigor Hutasuhut 2024-04-26 15:09:34 +07:00
parent a0ff88cd43
commit 0b04bed992
2 changed files with 3 additions and 3 deletions

View file

@ -68,7 +68,7 @@ func (api *API) PubsubStartDownloadSubreddit(ctx context.Context, params PubsubS
subreddit, err := models.Subreddits.Query(ctx, api.db, models.SelectWhere.Subreddits.Name.EQ(params.Subreddit)).One()
if err != nil {
if err.Error() == "sql: no rows in result set" {
return errs.Wrapw(err, "subreddit not found", "params", params).Code(http.StatusNotFound)
return errs.Wrapw(err, "subreddit not registered", "params", params).Code(http.StatusNotFound)
}
return errs.Wrapw(err, "failed to verify subreddit existence", "params", params)
}

View file

@ -1,8 +1,8 @@
POST http://localhost:8080/api/v1/subreddits/start HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Content-Length: 29
Content-Length: 30
{
"subreddit": "awoo"
"subreddit": "awoo3"
}