Merge "Avoid referencing Message.__str__ in exceptions"

This commit is contained in:
Jenkins 2014-04-14 03:45:23 +00:00 committed by Gerrit Code Review
commit ce9ffe10c2
4 changed files with 11 additions and 6 deletions

View File

@ -120,11 +120,14 @@ class HeatException(Exception):
raise exc_info[0], exc_info[1], exc_info[2]
def __str__(self):
return str(self.message)
return unicode(self.message).encode('UTF-8')
def __unicode__(self):
return unicode(self.message)
def __deepcopy__(self, memo):
return self.__class__(**self.kwargs)
class MissingCredentialError(HeatException):
msg_fmt = _("Missing required credential: %(required)s")

View File

@ -22,7 +22,7 @@ from heat.engine import resources
from heat.common import exception
class InvalidSchemaError(Exception):
class InvalidSchemaError(exception.Error):
pass

View File

@ -13,6 +13,7 @@
import json
from heat.common import exception
from heat.common import identifier
from heat.engine import constraints
from heat.engine import properties
@ -126,13 +127,13 @@ class UpdateWaitConditionHandle(WaitConditionHandle):
raise resource.UpdateReplace(self.name)
class WaitConditionFailure(Exception):
class WaitConditionFailure(exception.Error):
def __init__(self, wait_condition, handle):
reasons = handle.get_status_reason(STATUS_FAILURE)
super(WaitConditionFailure, self).__init__(reasons)
class WaitConditionTimeout(Exception):
class WaitConditionTimeout(exception.Error):
def __init__(self, wait_condition, handle):
reasons = handle.get_status_reason(STATUS_SUCCESS)
vals = {'len': len(reasons),

View File

@ -91,10 +91,11 @@ class ExceptionGroup(Exception):
self.exceptions = list(exceptions)
def __str__(self):
return str(map(str, self.exceptions))
return unicode([unicode(ex).encode('utf-8')
for ex in self.exceptions]).encode('utf-8')
def __unicode__(self):
return unicode(map(str, self.exceptions))
return unicode(map(unicode, self.exceptions))
class TaskRunner(object):