[entropy.exceptions] expose __unicode__ builtin method in EntropyException
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
This module contains Entropy Framework exceptions classes.
|
||||
|
||||
"""
|
||||
from entropy.const import const_isstring
|
||||
from entropy.const import const_isstring, const_convert_to_unicode
|
||||
|
||||
class DumbException(Exception):
|
||||
"""Dumb exception class"""
|
||||
@@ -22,6 +22,11 @@ class EntropyException(Exception):
|
||||
self.value = value[:]
|
||||
Exception.__init__(self)
|
||||
|
||||
def __unicode__(self):
|
||||
if const_isstring(self.value):
|
||||
return const_convert_to_unicode(self.value)
|
||||
return const_convert_to_unicode(repr(self.value))
|
||||
|
||||
def __str__(self):
|
||||
if const_isstring(self.value):
|
||||
return self.value
|
||||
|
||||
Reference in New Issue
Block a user