def _handle_create_exception(*exc_info):
"""The `CREATE_EXCEPTIONS` dict containing the relationships between
the nova exceptions and the webob exception classes to be raised is
defined at the top of this file.
"""
error = exc_info[1]
err_cls = error.__class__
cls_to_raise = CREATE_EXCEPTIONS.get(err_cls)
if cls_to_raise is None:
# The error is a subclass of one of the dict keys
to_raise = [val for key, val in CREATE_EXCEPTIONS.items()
if isinstance(error, key)]
if len(to_raise) > 1:
cls_to_raise = Controller._resolve_exception(to_raise)
elif not to_raise:
# Not any of the expected exceptions, so re-raise
six.reraise(*exc_info)
else:
cls_to_raise = to_raise[0]
for key, val in CREATE_EXCEPTIONS_MSGS.items():
if isinstance(error, key):
raise cls_to_raise(explanation=CREATE_EXCEPTIONS_MSGS[key])
raise cls_to_raise(explanation=error.format_message())
servers.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录