Created
July 20, 2020 12:19
-
-
Save andreastt/100c3bde91b1305a307af5a017b97e00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import six | |
class FooException(Exception): | |
def __init__(self, message): | |
if six.PY2 and isinstance(message, six.text_type): | |
super(FooException, self).__init__(message.encode("utf-8")) | |
else: | |
super(FooException, self).__init__(message) | |
def __unicode__(self): | |
return str(self).decode("utf-8") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment