Fix exception handling
There may be some cases where we call ManagerError and pass 'details' as a paramter instead of manager. This makes the code more robust. Change-Id: I03e4ccf0c1a074798ce364bd7ffd647b703196d1
This commit is contained in:
parent
6bd068859e
commit
a18187dab8
@ -56,11 +56,13 @@ class ManagerError(NsxLibException):
|
||||
"for %(operation)s %(details)s")
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
kwargs['details'] = (': %s' % kwargs['details']
|
||||
if 'details' in kwargs
|
||||
else '')
|
||||
details = kwargs.get('details', '')
|
||||
kwargs['details'] = ': %s' % details
|
||||
super(ManagerError, self).__init__(**kwargs)
|
||||
self.msg = self.message % kwargs
|
||||
try:
|
||||
self.msg = self.message % kwargs
|
||||
except KeyError:
|
||||
self.msg = details
|
||||
|
||||
|
||||
class ResourceNotFound(ManagerError):
|
||||
|
Loading…
x
Reference in New Issue
Block a user