Closed espertus closed 1 year ago
Yes, this is a good change.
Implementing validation on the client should lead to fewer resources being used as we're able to catch invalid requests faster. One thing I'll mention is to add a clear message inside the IllegalArgumentException.
I'm also not sure how well documented the Reddit API is, so I guess some further testing might be required to catch all edge cases.
Fixed in #14 and also in #15
Is your feature request related to a problem? Please describe. I am creating a (toy) Reddit client with Reddit4J I have encountered two problems with
Reddit4J.getSubreddit(String name)
:RedditSubreddit
is returned where every member has the zero value.org.jsoup.HttpStatusException
.Describe the solution you'd like
I propose (and am willing to implement):
IllegalArgumentException
(or whatever you prefer) if the name is invalid.null
or throwingIllegalArgumentException
(or whatever you prefer) if the subreddit does not exist.Describe alternatives you've considered I could wrap the method in my own method to do all of the above.
Additional context These are the rules for subreddit names: