Commit Graph

14 Commits

Author SHA1 Message Date
Barry Warsaw 40db48c5ec Document the correct class hierarchy for SystemExit. It is not an
error and so it derives from Exception and not SystemError.  The
docstring was incorrect but the implementation was fine.
1999-02-24 00:27:39 +00:00
Guido van Rossum 433892021e Added doc strings to the exception classes.
Contributed by Blake Winton, but considerably edited.
1999-01-15 04:03:46 +00:00
Barry Warsaw 8fe2a34e1f Added NotImplementedError, subclassed from RuntimeError 1998-12-01 18:36:30 +00:00
Barry Warsaw 9195f55bbf Updated the docstring and class hierarchy diagram 1998-09-25 22:43:21 +00:00
Guido van Rossum be21d98cee Use repr() on the filename in EnvironmentError.__str__(). This
displays funny characters, like spaces or control characters, more
clearly (one of my pet peeves in error messages).  Also only suppress
the filename if it is None; display it if it is '', since that would
be a genuine (illegal) filename passed in!
1998-08-11 18:01:32 +00:00
Jeremy Hylton ec8c8c2ef2 fix __str__ method of EnvironmentError (base class of IOError): was
using "%d" % errno to print out IOError exceptions -- but urllib.py
raises exceptions where the errno slot in the exception tuple is a
string.
1998-07-28 17:30:06 +00:00
Barry Warsaw 2dfe4de614 Added support for including the filename in IOErrors and OSErrors that
involve a filesystem path.  To that end:

- Changed IOError to EnvironmentError and added a hack which checks
  for arg of len 3.  When constructed with a 3-tuple, the third item
  is the filename and this is squirreled away in the `filename'
  attribute.   However, for in-place unpacking backwards
  compatibility, self.args still only gets the first two items.  Added
  a __str__() which prints the filename if it is given.

- IOError now inherits from EnvironmentError

- New class OSError which also inherits from EnvironmentError and is
  used by the posix module.
1998-07-23 16:03:46 +00:00
Guido van Rossum 45e2fbc2e7 Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
Fred Drake 596db3161c Move the __getitem__() definition from StandardException to Exception.
This allows stuff like this out of the box:

	try:
	    ...
	except socket.error, (code, msg):
	    ...
1997-10-06 15:48:20 +00:00
Barry Warsaw 25131faffe NumberError => ArithmeticError 1997-09-16 21:50:59 +00:00
Guido van Rossum c56ba38350 Two subtle changes:
(1) Introduce Exception as the conceptual root class for all exceptions.

(2) Do less work in __init__(), and more in __str__ (store args
unchanged).
1997-09-16 18:42:04 +00:00
Guido van Rossum e8fd143b7e #Adapt the doc string to reality. 1997-09-08 02:47:46 +00:00
Guido van Rossum f394f56c2b Made the 'info' argument to SyntaxError optional, so phase-2 syntax
errors are handled (these gave ``TypeError: not enough arguments'').

Also changed its __str__() to correct a typo (missing self.) and
return str(self.msg) to ensure the result is always string.

Also changed the default __str__ to simply return str(self.args).
1997-09-05 19:00:56 +00:00
Barry Warsaw 3e613ce79b New file, which is imported by the built-in module when python is
started with the -X option.  This file contains the definitions for
the built-in exception classes.
1997-08-29 21:59:26 +00:00