Caught DoesNotExist exceptions in WebAPI, now raises 404

Review Request #3040 — Created April 3, 2012 and discarded

Information

Review Board

Reviewers

This addresses issue 2551.

Caught the DoesNotExist exceptions in the web API, and raised a HTTP 404 exception instead.
I tried to use the same language as in http://reviews.reviewboard.org/r/9999/
Testing done in Linux 3.2.13 with Chromium 18.0.

I visited local links that pointed to invalid review requests:
http://localhost:8080/api/review-requests/99/diffs/1/files/1/diff-comments/
http://localhost:8080/api/review-requests/999999999/screenshots/
Description From Last Updated

I'm not sure if this is the proper way to do this. I believe most other resources return a DOES_NOT_EXIST …

SM smacleod
AM
SM
  1. Just something that jumped out at me right away.
  2. reviewboard/webapi/resources.py (Diff revision 2)
     
     
     
     
    Show all issues
    I'm not sure if this is the proper way to do this. I believe most other resources return a DOES_NOT_EXIST to 404 in cases like this. The fact that you needed an extra import also makes me think this isn't the right way.
    1. That makes sense.
      
      This method is called by get_queryset, which is called by get_list in djblets as an argument of a response.
      Unfortunately, the only way to catch the exception is by using the most generic django.core.exceptions.ObjectDoesNotExist.
      
      So I'm going to close this review and open a new one.
  3. 
      
AM
Review request changed
Status:
Discarded