18F / epa-notice

Web interface for viewing and commenting on proposed changes to federal regulations
Other
7 stars 17 forks source link

Don't 500 if regs.gov is down #343

Closed cmc333333 closed 8 years ago

cmc333333 commented 8 years ago

Right now, /comments/review/0000_0000 will 500 if regs.gov is down (and the data isn't cached). Backtrace:

2016-06-02T17:34:31.43+0000 [App/0]      ERR Traceback (most recent call last):
2016-06-02T17:34:31.43+0000 [App/0]      ERR   File "/app/.heroku/python/lib/python3.4/site-packages/django/core/handlers/base.py", line 132, in get_response
2016-06-02T17:34:31.43+0000 [App/0]      ERR     response = wrapped_callback(request, *callback_args, **callback_kwargs)
2016-06-02T17:34:31.43+0000 [App/0]      ERR   File "/app/.heroku/python/lib/python3.4/site-packages/newrelic-2.66.0.49/newrelic/hooks/framework_django.py", line 503, in wrapper
2016-06-02T17:34:31.43+0000 [App/0]      ERR     return wrapped(*args, **kwargs)
2016-06-02T17:34:31.43+0000 [App/0]      ERR   File "/app/.heroku/python/lib/python3.4/site-packages/django/views/generic/base.py", line 71, in view
2016-06-02T17:34:31.43+0000 [App/0]      ERR     return self.dispatch(request, *args, **kwargs)
2016-06-02T17:34:31.43+0000 [App/0]      ERR   File "/app/.heroku/python/lib/python3.4/site-packages/newrelic-2.66.0.49/newrelic/hooks/framework_django.py", line 876, in wrapper
2016-06-02T17:34:31.43+0000 [App/0]      ERR     return wrapped(*args, **kwargs)
2016-06-02T17:34:31.43+0000 [App/0]      ERR   File "/app/.heroku/python/lib/python3.4/site-packages/django/views/generic/base.py", line 89, in dispatch
2016-06-02T17:34:31.43+0000 [App/0]      ERR     return handler(request, *args, **kwargs)
2016-06-02T17:34:31.43+0000 [App/0]      ERR   File "/home/vcap/app/.heroku/src/regulations/regulations/views/preamble.py", line 453, in get
2016-06-02T17:34:31.43+0000 [App/0]      ERR     settings.COMMENT_DOCUMENT_ID)
2016-06-02T17:34:31.43+0000 [App/0]      ERR   File "/home/vcap/app/.heroku/src/regulations/regulations/docket.py", line 34, in get_document_fields
2016-06-02T17:34:31.43+0000 [App/0]      ERR     metadata = fetch(settings.REGS_GOV_API_URL, params={'D': document_id})
2016-06-02T17:34:31.43+0000 [App/0]      ERR   File "/home/vcap/app/.heroku/src/regulations/regulations/docket.py", line 19, in fetch
2016-06-02T17:34:31.43+0000 [App/0]      ERR     response.raise_for_status()
2016-06-02T17:34:31.43+0000 [App/0]      ERR   File "/app/.heroku/python/lib/python3.4/site-packages/requests/models.py", line 844, in raise_for_status
2016-06-02T17:34:31.43+0000 [App/0]      ERR     raise HTTPError(http_error_msg, response=self)
2016-06-02T17:34:31.43+0000 [App/0]      ERR requests.exceptions.HTTPError: 404 Client Error: Not Found for url: [URL redacted]

This might be a good time to put field retrieval in the parser