Show a coherent error on bulk change lock timeout

Since it's possible that the user will try to get patches while the
update script is running, ensure we show a sensible error if the script
times out waiting for a lock.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2013-07-28 19:08:43 +01:00
parent 93ce26f21c
commit bea2db8464

View File

@ -232,6 +232,10 @@ def bulk_change_patch_view(request, pk):
return response
return HttpResponse('No patch data generated', content_type='text/plain')
except Exception as e:
output = getattr(e, 'output', None)
if output:
if 'timeout' in output:
return HttpResponse('Failed to generate patches: timed out waiting for lock. Please try again shortly.', content_type='text/plain')
return HttpResponse('Failed to generate patches: %s' % e, content_type='text/plain')
# FIXME better error handling