summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Hayes <graham.hayes@hp.com>2015-08-13 17:12:04 +0100
committerFederico Ceratto <federico.ceratto@hpe.com>2015-09-25 10:58:35 +0100
commitecd380604f17c77fb024cd1e50cc2dbcd99a9c96 (patch)
treec26b41f404f7103fbfaacb256b2e41210908c389
parent78a83cca4a58fb2e5589e3e6a682098cd7b5bd7e (diff)
downloaddesignate-ecd380604f17c77fb024cd1e50cc2dbcd99a9c96.tar.gz
Fix unhandled exceptions in adapters parsing
Change-Id: I25ea27c2b7d79982517f348fb3d43f4b5b045975 Closes-Bug: #1483404 (cherry picked from commit 12a82f5fec7d524dbfa9b5e288591f931462b268)
-rw-r--r--designate/objects/adapters/base.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/designate/objects/adapters/base.py b/designate/objects/adapters/base.py
index 06663025..f70cddf8 100644
--- a/designate/objects/adapters/base.py
+++ b/designate/objects/adapters/base.py
@@ -162,19 +162,18 @@ class DesignateAdapter(object):
LOG.exception(_LE("TypeError creating %(name)s with values"
" %(values)r") %
{"name": output_object.obj_name(), "values": values})
-
- error_message = str.format(
- 'Provided object does not match schema. '
- 'Got a TypeError with message %s' % six.text_type(e))
+ error_message = (u'Provided object is not valid. '
+ u'Got a TypeError with message {}'.format(
+ six.text_type(e)))
raise exceptions.InvalidObject(error_message)
except AttributeError as e:
LOG.exception(_LE("AttributeError creating %(name)s "
"with values %(values)r") %
{"name": output_object.obj_name(), "values": values})
- error_message = str.format(
- 'Provided object is not valid. '
- 'Got an AttributeError with message %s' % six.text_type(e))
+ error_message = (u'Provided object is not valid. '
+ u'Got an AttributeError with message {}'.format(
+ six.text_type(e)))
raise exceptions.InvalidObject(error_message)
except exceptions.InvalidObject:
@@ -187,10 +186,9 @@ class DesignateAdapter(object):
LOG.exception(_LE("Exception creating %(name)s with "
"values %(values)r") %
{"name": output_object.obj_name(), "values": values})
- error_message = str.format(
- 'Provided object is not valid. '
- 'Got a %s error with message %s' %
- (type(e).__name__, six.text_type(e)))
+ error_message = (u'Provided object is not valid. '
+ u'Got a {} error with message {}'.format(
+ type(e).__name__, six.text_type(e)))
raise exceptions.InvalidObject(error_message)
@classmethod