Commit 84275444 by Arnau Comas Codina

OpenStackError decorator for exceptions, minor change

parent 5b8b9cae
from openstack.exceptions import BadRequestException
from interface.network.port_forwarding import PortForwardingInterface
from interface.network.resources import Port, FloatingIP, PortForwarding
......
......@@ -8,17 +8,12 @@ class ErrorException(Exception):
Attributes:
OpenStackError -- boolean
DuplicateError -- boolean
"""
def __init__(self, e):
super().__init__(e)
self.OpenStackError = True
self.DuplicateError = False
if hasattr(e, 'details'):
if 'duplicate' in e.details:
self.DuplicateError = True
def OpenStackError(func):
......@@ -36,7 +31,6 @@ def OpenStackError(func):
raise ErrorException(e)
except BadRequestException as e:
import pdb; pdb.set_trace()
raise ErrorException(e)
except Exception as e:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment