python3 ValueError object has no attribute message

Change-Id: I09862b245774ab4b26f2ea11dfe4d0cc1d4305b7
This commit is contained in:
zhurong 2018-12-13 13:43:12 +08:00
parent 04bfb5778b
commit e6dc1f0819
1 changed files with 5 additions and 2 deletions

View File

@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from oslo_log import log as logging
from oslo_messaging.rpc import client
from webob import exc
@ -68,8 +70,9 @@ class Controller(object):
raise exc.HTTPServiceUnavailable(e.value)
except ValueError as e:
LOG.error('Exception during call of the method {method_name}: '
'{exc}'.format(method_name=method_name, exc=str(e)))
raise exc.HTTPBadRequest(e.message)
'{exc}'.format(method_name=method_name,
exc=six.text_type(e)))
raise exc.HTTPBadRequest(six.text_type(e))
def create_resource():