Fix error message in share delete method

Currently, if share has snapshots, method delete() in
share api service fails with 403 code, but without any
error message and user can't understand what goes wrong.

Error message was added to the HTTP exception, so client
can show appropriate reason of error.

Change-Id: Ida3b69d9ef6c7f150e2aa1980ddba653247b3175
Closes-Bug: #1400816
This commit is contained in:
Igor Malinovskiy 2014-12-16 09:13:52 +02:00
parent 2023930fd7
commit 147fdfae50

View File

@ -92,8 +92,8 @@ class ShareController(wsgi.Controller):
self.share_api.delete(context, share)
except exception.NotFound:
raise exc.HTTPNotFound()
except exception.InvalidShare:
raise exc.HTTPForbidden()
except exception.InvalidShare as e:
raise exc.HTTPForbidden(explanation=six.text_type(e))
return webob.Response(status_int=202)