summaryrefslogtreecommitdiff
path: root/glance_store/common
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2016-01-07 09:33:49 +0100
committerVictor Stinner <vstinner@redhat.com>2016-01-21 11:07:10 +0100
commitfc876c97dbf5b4527d490a0d6f04109af8d38ac8 (patch)
tree145e8004ab6a82851d658385d888fab192a9984f /glance_store/common
parent8a7729110a5ab203c363fdf5cc0a2f1dc069bf66 (diff)
downloadglance_store-fc876c97dbf5b4527d490a0d6f04109af8d38ac8.tar.gz
Use oslo_utils.encodeutils.exception_to_unicode()
Replace glance_store.common.utils.exception_to_str() with encodeutils.exception_to_unicode(). exception_to_unicode() tries more options to get a nice error message as Unicode from an exception object. As exception_to_str(), it catches and handles exceptions. Remove glance_store.common.utils.exception_to_str() and related unit tests. The function is not part of the store API and Glance does not use it. glance already uses exception_to_unicode(): see change I86008c8adc0c5664f96573c1015cc15e2d06e3e2. By the way, glance did not use exception_to_str() from glance_store but had its own copy of the function (which was removed by the mentioned change). Change-Id: I52cab2e773c257e36d36290f6060811f83f18bb0
Diffstat (limited to 'glance_store/common')
-rw-r--r--glance_store/common/utils.py16
1 files changed, 0 insertions, 16 deletions
diff --git a/glance_store/common/utils.py b/glance_store/common/utils.py
index 3ade953..9bdb387 100644
--- a/glance_store/common/utils.py
+++ b/glance_store/common/utils.py
@@ -25,8 +25,6 @@ try:
from eventlet import sleep
except ImportError:
from time import sleep
-from oslo_utils import encodeutils
-import six
from glance_store.i18n import _
@@ -141,17 +139,3 @@ class CooperativeReader(object):
def __iter__(self):
return cooperative_iter(self.fd.__iter__())
-
-
-def exception_to_str(exc):
- try:
- error = six.text_type(exc)
- except UnicodeError:
- try:
- error = str(exc)
- except UnicodeError:
- error = ("Caught '%(exception)s' exception." %
- {"exception": exc.__class__.__name__})
- if six.PY2:
- error = encodeutils.safe_encode(error, errors='ignore')
- return error