]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Change generic NotFound to specific exception
authorPranaliDeore <pranali11.deore@nttdata.com>
Tue, 26 May 2015 07:12:27 +0000 (00:12 -0700)
committerPranaliDeore <pranali11.deore@nttdata.com>
Thu, 25 Jun 2015 12:25:07 +0000 (05:25 -0700)
commitcb8bce4f1bd5f6709441d45373ea3b99c7eb4b9b
tree17d601fdc12c48348fded3f3c7ddb5ff8a190530
parentdc9a8c8f5d369eb121053fcdc362648e219d968f
Change generic NotFound to specific exception

1. Changed exception type from NotFound to specific NotFound
   exception for better readability.
   e.g. VolumeNotFound, SnapshotNotFound etc.

2. Error messages returned to the user are not consistent across
   all apis in case of all exceptions derived from NotFound exception.
   Instead of returning custom error messages return message
   defined in exception class itself.
   NOTE: Doesn't applied to 'HostBinaryNotFound' as host information to
         the tenant should not be leaked.

3. Added explanation to HTTPNotFound wherever appropriate.
   e.g. raise webob.exc.HTTPNotFound() to
        raise webob.exc.HTTPNotFound(explanation=err.msg)

Closes-Bug: #1459958
Change-Id: Ice2c375796fac7533d82125ef97288075fa68b85
20 files changed:
cinder/api/contrib/admin_actions.py
cinder/api/contrib/cgsnapshots.py
cinder/api/contrib/consistencygroups.py
cinder/api/contrib/qos_specs_manage.py
cinder/api/contrib/types_extra_specs.py
cinder/api/contrib/types_manage.py
cinder/api/contrib/volume_manage.py
cinder/api/contrib/volume_replication.py
cinder/api/contrib/volume_type_access.py
cinder/api/contrib/volume_type_encryption.py
cinder/api/contrib/volume_unmanage.py
cinder/api/v2/snapshots.py
cinder/api/v2/types.py
cinder/api/v2/volume_metadata.py
cinder/api/v2/volumes.py
cinder/tests/unit/api/contrib/test_cgsnapshots.py
cinder/tests/unit/api/contrib/test_consistencygroups.py
cinder/tests/unit/api/contrib/test_volume_unmanage.py
cinder/tests/unit/api/v2/stubs.py
cinder/tests/unit/api/v2/test_snapshots.py