Convert some old-style string exceptions to class exceptions.

This commit is contained in:
Fred Drake 2000-08-17 05:06:49 +00:00
parent 9b8d801c37
commit 227b120468
6 changed files with 17 additions and 12 deletions

View File

@ -137,7 +137,8 @@ writeframesraw.
import struct import struct
import __builtin__ import __builtin__
Error = 'aifc.Error' class Error(Exception):
pass
_AIFC_version = 0xA2805140 # Version 1 of AIFF-C _AIFC_version = 0xA2805140 # Version 1 of AIFF-C

View File

@ -1,6 +1,7 @@
"""Classes for manipulating audio devices (currently only for Sun and SGI)""" """Classes for manipulating audio devices (currently only for Sun and SGI)"""
error = 'audiodev.error' class error(Exception):
pass
class Play_Audio_sgi: class Play_Audio_sgi:
# Private instance variables # Private instance variables

View File

@ -27,7 +27,8 @@ import struct
import string import string
import binascii import binascii
Error = 'binhex.Error' class Error(Exception):
pass
# States (what have we written) # States (what have we written)
[_DID_HEADER, _DID_DATA, _DID_RSRC] = range(3) [_DID_HEADER, _DID_DATA, _DID_RSRC] = range(3)

View File

@ -52,8 +52,9 @@ __getstate__() and __setstate__(). See the documentation for module
import types import types
error = 'copy.error' class Error(Exception):
Error = error # backward compatibility pass
error = Error # backward compatibility
def copy(x): def copy(x):
"""Shallow copy operation on arbitrary Python objects. """Shallow copy operation on arbitrary Python objects.

View File

@ -56,16 +56,16 @@ FTP_PORT = 21
# Exception raised when an error or invalid response is received # Exception raised when an error or invalid response is received
error_reply = 'ftplib.error_reply' # unexpected [123]xx reply class Error(Exception): pass
error_temp = 'ftplib.error_temp' # 4xx errors class error_reply(Error): pass # unexpected [123]xx reply
error_perm = 'ftplib.error_perm' # 5xx errors class error_temp(Error): pass # 4xx errors
error_proto = 'ftplib.error_proto' # response does not begin with [1-5] class error_perm(Error): pass # 5xx errors
class error_proto(Error): pass # response does not begin with [1-5]
# All exceptions (hopefully) that may be raised here and that aren't # All exceptions (hopefully) that may be raised here and that aren't
# (always) programming errors on our side # (always) programming errors on our side
all_errors = (error_reply, error_temp, error_perm, error_proto, \ all_errors = (Error, socket.error, IOError, EOFError)
socket.error, IOError, EOFError)
# Line terminators (we always output CRLF, but accept any of CRLF, CR, LF) # Line terminators (we always output CRLF, but accept any of CRLF, CR, LF)

View File

@ -30,7 +30,8 @@ seekable stream object.
import sys import sys
import string import string
Error = 'multifile.Error' class Error(Exception):
pass
class MultiFile: class MultiFile: