Fix 500 error when attempting to subscribe to a non-existent subreddit. #306

Closed
wants to merge 1 commit into
from

3 participants

@bboe

This fix also works with pull request #305 by @buddydvd.

@kemitche

This is better than 500'ing, but I feel like some sort of error condition needs to be communicated back to the client

@bboe

Agreed, though POST_subscribe has the @noresponse form handler. I didn't want to break other things by changing that. Suggestions?

@bboe

Now that I'm looking at other @noresponse functions, it seems some of them also do not check to make sure the object actually exists ((un)mark_nsfw) and others, like my fix, simply return without any warning if the object is not valid. One option is to return 404 errors in place of failure, and 200 when the action actually was performed successfully.

@kemitche

I didn't notice the @noresponse part. I guess @spladug or @chromakode would be best to ask how to approach - 404 seems ok, but since there's precedent for simply returning without warning, that's probably ok as well.

@bboe

For v2 of the API, the Amazon S3 error handling method would be a good model to follow, with json instead of xml of course :).

@spladug
reddit member

Merged as 05062bf. Thanks!

@spladug spladug closed this Apr 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment