Lichen

lib/__builtins__/exception/unicode.py

821:ed27b57be1df
2018-01-15 Paul Boddie Introduced parameter-based attribute initialisation for broader testing.
     1 #!/usr/bin/env python     2      3 """     4 Unicode exception objects.     5      6 Copyright (C) 2015, 2016, 2017, 2018 Paul Boddie <paul@boddie.org.uk>     7      8 This program is free software; you can redistribute it and/or modify it under     9 the terms of the GNU General Public License as published by the Free Software    10 Foundation; either version 3 of the License, or (at your option) any later    11 version.    12     13 This program is distributed in the hope that it will be useful, but WITHOUT    14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS    15 FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more    16 details.    17     18 You should have received a copy of the GNU General Public License along with    19 this program.  If not, see <http://www.gnu.org/licenses/>.    20 """    21     22 class UnicodeError(ValueError):    23     24     "A general Unicode error."    25     26     pass    27     28 class UnicodeDecodeError(UnicodeError):    29     30     """    31     An exception indicating a failure to interpret a byte sequence according to    32     a character encoding.    33     """    34     35     def __init__(self, .value):    36     37         """    38         Initialise an exception with a 'value' providing the illegal byte    39         sequence responsible for the error.    40         """    41     42         pass    43     44 class UnicodeEncodeError(UnicodeError): pass    45 class UnicodeTranslateError(UnicodeError): pass    46     47 # vim: tabstop=4 expandtab shiftwidth=4