Pass kwargs to exception to get better format of error message

If we do not pass kwargs to exception, the parameter will be deemed
as message and will be displayed directly. This is to pass kwargs to
InvalidOperatorError and URLValidationError, to get better format of
error message.

Change-Id: I5220d7af077a6c2eb1fe49cbbd7421169fa5b015
This commit is contained in:
zhufl 2019-04-17 15:41:13 +08:00
parent b357a96ac0
commit df89c7eef2
2 changed files with 2 additions and 2 deletions

View File

@ -456,7 +456,7 @@ def check_endpoint_url(url):
try:
url.replace('$(', '%(') % substitutions
except (KeyError, TypeError, ValueError):
raise exception.URLValidationError(url)
raise exception.URLValidationError(url=url)
def create_directory(directory, keystone_user_id=None, keystone_group_id=None):

View File

@ -1016,7 +1016,7 @@ class Manager(manager.Manager):
try:
filter_['comparator'] = operators[op]
except KeyError:
raise exception.InvalidOperatorError(op)
raise exception.InvalidOperatorError(_op=op)
return hints
def _handle_shadow_and_local_users(self, driver, hints):