juju-solutions / review-queue

Juju Review Queue webapp
4 stars 4 forks source link

Handle EntityNotFound errors more gracefully #75

Closed johnsca closed 7 years ago

johnsca commented 7 years ago

We get a lot of error emails like this:

Task reviewqueue.tasks.refresh_review with id 178de251-8093-405b-b097-9109250084a1 raised exception:
"EntityNotFound('https://api.jujucharms.com/v4/~ibmcharmers/xenial/ibm-cinder-xiv/meta/any?include=revision-info&include=promulgated&include=id-name&include=owner&channel=stable',)"

Task was called with args: (<reviewqueue.models.review.Review object at 0x7fdbacbe7b10>,) kwargs: {}.

The contents of the full traceback was:

Traceback (most recent call last):
  File "/opt/reviewqueue/.venv/local/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/opt/reviewqueue/.venv/local/lib/python2.7/site-packages/celery/app/trace.py", line 438, in __protected_call__
    return self.run(*args, **kwargs)
  File "/opt/reviewqueue/reviewqueue/tasks.py", line 33, in refresh_review
    review.refresh_revisions(celery.settings)
  File "/opt/reviewqueue/reviewqueue/models/review.py", line 174, in refresh_revisions
    channel=self.channel)
  File "/opt/reviewqueue/reviewqueue/helpers.py", line 108, in get_charmstore_entity
    raise ValueError('Missing USSO token')
  File "/opt/reviewqueue/.venv/local/lib/python2.7/site-packages/theblues/charmstore.py", line 104, in _meta
    data = self._get(url)
  File "/opt/reviewqueue/.venv/local/lib/python2.7/site-packages/theblues/charmstore.py", line 59, in _get
    raise EntityNotFound(url)
EntityNotFound: https://api.jujucharms.com/v4/~ibmcharmers/xenial/ibm-cinder-xiv/meta/any?include=revision-info&include=promulgated&include=id-name&include=owner&channel=stable

This seems to happen when the charm author does something strange with the charm store, but we should handle it more gracefully.