diff options
author | Fred Drake <fdrake@acm.org> | 2000-08-17 05:06:49 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-08-17 05:06:49 (GMT) |
commit | 227b1204681a8bd7077bf1f8e9098b7e2e9f4c13 (patch) | |
tree | 25e36d9096e5ddcde4a12065b5d38d4dd9beed56 /Lib | |
parent | 9b8d801c37fa29420848ebc1b50c601893b36287 (diff) | |
download | cpython-227b1204681a8bd7077bf1f8e9098b7e2e9f4c13.zip cpython-227b1204681a8bd7077bf1f8e9098b7e2e9f4c13.tar.gz cpython-227b1204681a8bd7077bf1f8e9098b7e2e9f4c13.tar.bz2 |
Convert some old-style string exceptions to class exceptions.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/aifc.py | 3 | ||||
-rw-r--r-- | Lib/audiodev.py | 3 | ||||
-rw-r--r-- | Lib/binhex.py | 3 | ||||
-rw-r--r-- | Lib/copy.py | 5 | ||||
-rw-r--r-- | Lib/ftplib.py | 12 | ||||
-rw-r--r-- | Lib/multifile.py | 3 |
6 files changed, 17 insertions, 12 deletions
diff --git a/Lib/aifc.py b/Lib/aifc.py index e00b23f..f709d88 100644 --- a/Lib/aifc.py +++ b/Lib/aifc.py @@ -137,7 +137,8 @@ writeframesraw. import struct import __builtin__ -Error = 'aifc.Error' +class Error(Exception): + pass _AIFC_version = 0xA2805140 # Version 1 of AIFF-C diff --git a/Lib/audiodev.py b/Lib/audiodev.py index e7cff6c..9d4ddc2 100644 --- a/Lib/audiodev.py +++ b/Lib/audiodev.py @@ -1,6 +1,7 @@ """Classes for manipulating audio devices (currently only for Sun and SGI)""" -error = 'audiodev.error' +class error(Exception): + pass class Play_Audio_sgi: # Private instance variables diff --git a/Lib/binhex.py b/Lib/binhex.py index 275701d..0892203 100644 --- a/Lib/binhex.py +++ b/Lib/binhex.py @@ -27,7 +27,8 @@ import struct import string import binascii -Error = 'binhex.Error' +class Error(Exception): + pass # States (what have we written) [_DID_HEADER, _DID_DATA, _DID_RSRC] = range(3) diff --git a/Lib/copy.py b/Lib/copy.py index e4679de..100ea13 100644 --- a/Lib/copy.py +++ b/Lib/copy.py @@ -52,8 +52,9 @@ __getstate__() and __setstate__(). See the documentation for module import types -error = 'copy.error' -Error = error # backward compatibility +class Error(Exception): + pass +error = Error # backward compatibility def copy(x): """Shallow copy operation on arbitrary Python objects. diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 41c3b33..a15c412 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -56,16 +56,16 @@ FTP_PORT = 21 # Exception raised when an error or invalid response is received -error_reply = 'ftplib.error_reply' # unexpected [123]xx reply -error_temp = 'ftplib.error_temp' # 4xx errors -error_perm = 'ftplib.error_perm' # 5xx errors -error_proto = 'ftplib.error_proto' # response does not begin with [1-5] +class Error(Exception): pass +class error_reply(Error): pass # unexpected [123]xx reply +class error_temp(Error): pass # 4xx errors +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 # (always) programming errors on our side -all_errors = (error_reply, error_temp, error_perm, error_proto, \ - socket.error, IOError, EOFError) +all_errors = (Error, socket.error, IOError, EOFError) # Line terminators (we always output CRLF, but accept any of CRLF, CR, LF) diff --git a/Lib/multifile.py b/Lib/multifile.py index cc8f43c..e43d331 100644 --- a/Lib/multifile.py +++ b/Lib/multifile.py @@ -30,7 +30,8 @@ seekable stream object. import sys import string -Error = 'multifile.Error' +class Error(Exception): + pass class MultiFile: |