summaryrefslogtreecommitdiffstats
path: root/Lib/exceptions.py
Commit message (Collapse)AuthorAgeFilesLines
* This module is obsolete now that the standard exceptions are built-in.Barry Warsaw2000-05-261-4/+0
|
* For backwards compatibility, simply import everything from theBarry Warsaw2000-05-251-247/+4
| | | | _exceptions module, including __doc__.
* Marc-Andre Lemburg: Add UnicodeError, derived from ValueError.Guido van Rossum2000-03-101-0/+7
|
* Added WindowsError, for Mark Hammond's extensions.Guido van Rossum2000-02-171-0/+6
|
* A nit to make Fred proud.Barry Warsaw1999-08-191-0/+1
|
* Patch by Tim Peters:Guido van Rossum1999-06-221-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new builtin exception, UnboundLocalError, raised when ceval.c tries to retrieve or delete a local name that isn't bound to a value. Currently raises NameError, which makes this behavior a FAQ since the same error is raised for "missing" global names too: when the user has a global of the same name as the unbound local, NameError makes no sense to them. Even in the absence of shadowing, knowing whether a bogus name is local or global is a real aid to quick understanding. Example: D:\src\PCbuild>type local.py x = 42 def f(): print x x = 13 return x f() D:\src\PCbuild>python local.py Traceback (innermost last): File "local.py", line 8, in ? f() File "local.py", line 4, in f print x UnboundLocalError: x D:\src\PCbuild> Note that UnboundLocalError is a subclass of NameError, for compatibility with existing class-exception code that may be trying to catch this as a NameError. Unfortunately, I see no way to make this wholly compatible with -X (see comments in bltinmodule.c): under -X, [UnboundLocalError is an alias for NameError --GvR]. [The ceval.c patch differs slightly from the second version that Tim submitted; I decided not to raise UnboundLocalError for DELETE_NAME, only for DELETE_LOCAL. DELETE_NAME is only generated at the module level, and since at that level a NameError is raised for referencing an undefined name, it should also be raised for deleting one.]
* Document the correct class hierarchy for SystemExit. It is not anBarry Warsaw1999-02-241-5/+6
| | | | | error and so it derives from Exception and not SystemError. The docstring was incorrect but the implementation was fine.
* Added doc strings to the exception classes.Guido van Rossum1999-01-151-3/+29
| | | | Contributed by Blake Winton, but considerably edited.
* Added NotImplementedError, subclassed from RuntimeErrorBarry Warsaw1998-12-011-2/+10
|
* Updated the docstring and class hierarchy diagramBarry Warsaw1998-09-251-12/+20
|
* Use repr() on the filename in EnvironmentError.__str__(). ThisGuido van Rossum1998-08-111-2/+2
| | | | | | | 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!
* fix __str__ method of EnvironmentError (base class of IOError): wasJeremy Hylton1998-07-281-2/+2
| | | | | | using "%d" % errno to print out IOError exceptions -- but urllib.py raises exceptions where the errno slot in the exception tuple is a string.
* Added support for including the filename in IOErrors and OSErrors thatBarry Warsaw1998-07-231-3/+32
| | | | | | | | | | | | | | | | 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.
* Mass check-in after untabifying all files that need it.Guido van Rossum1998-03-261-17/+17
|
* Move the __getitem__() definition from StandardException to Exception.Fred Drake1997-10-061-1/+3
| | | | | | | | | This allows stuff like this out of the box: try: ... except socket.error, (code, msg): ...
* NumberError => ArithmeticErrorBarry Warsaw1997-09-161-5/+5
|
* Two subtle changes:Guido van Rossum1997-09-161-69/+56
| | | | | | | (1) Introduce Exception as the conceptual root class for all exceptions. (2) Do less work in __init__(), and more in __str__ (store args unchanged).
* #Adapt the doc string to reality.Guido van Rossum1997-09-081-7/+6
|
* Made the 'info' argument to SyntaxError optional, so phase-2 syntaxGuido van Rossum1997-09-051-8/+11
| | | | | | | | | 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).
* New file, which is imported by the built-in module when python isBarry Warsaw1997-08-291-0/+164
started with the -X option. This file contains the definitions for the built-in exception classes.