Return related error code with ManagerError

For error handler to decide the exact error type,
related error code is needed. The field will be empty
list if there is not related error

Issue: #

Change-Id: I53ad9e6da41ab65ea96414753635576c64d5d6d0
This commit is contained in:
Erica Liu
2019-01-22 16:56:23 -08:00
committed by Abhishek Raut
parent fb84d8721f
commit eedad6e61b
3 changed files with 18 additions and 6 deletions

View File

@@ -70,6 +70,7 @@ class NsxLibInvalidInput(NsxLibException):
class ManagerError(NsxLibException):
message = _("Unexpected error from backend manager (%(manager)s) "
"for %(operation)s%(details)s")
related_error_codes = []
def __init__(self, **kwargs):
details = kwargs.get('details', '')
@@ -80,6 +81,7 @@ class ManagerError(NsxLibException):
except KeyError:
self.msg = details
self.error_code = kwargs.get('error_code')
self.related_error_codes = kwargs.get('related_error_codes', [])
class ResourceNotFound(ManagerError):