paul@6 | 1 | #!/usr/bin/env python |
paul@6 | 2 | |
paul@6 | 3 | """ |
paul@470 | 4 | Base exception objects. See __builtins__.core for the core exceptions. |
paul@6 | 5 | |
paul@233 | 6 | Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> |
paul@6 | 7 | |
paul@6 | 8 | This program is free software; you can redistribute it and/or modify it under |
paul@6 | 9 | the terms of the GNU General Public License as published by the Free Software |
paul@6 | 10 | Foundation; either version 3 of the License, or (at your option) any later |
paul@6 | 11 | version. |
paul@6 | 12 | |
paul@6 | 13 | This program is distributed in the hope that it will be useful, but WITHOUT |
paul@6 | 14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@6 | 15 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@6 | 16 | details. |
paul@6 | 17 | |
paul@6 | 18 | You should have received a copy of the GNU General Public License along with |
paul@6 | 19 | this program. If not, see <http://www.gnu.org/licenses/>. |
paul@6 | 20 | """ |
paul@6 | 21 | |
paul@470 | 22 | class LookupError(Exception): |
paul@470 | 23 | |
paul@470 | 24 | "A general lookup error." |
paul@470 | 25 | |
paul@470 | 26 | pass |
paul@470 | 27 | |
paul@470 | 28 | class IndexError(LookupError): |
paul@262 | 29 | |
paul@262 | 30 | "An error condition involving an index." |
paul@262 | 31 | |
paul@262 | 32 | def __init__(self, index): |
paul@262 | 33 | self.index = index |
paul@262 | 34 | |
paul@470 | 35 | class KeyError(LookupError): |
paul@288 | 36 | |
paul@288 | 37 | "An error concerned with a dictionary key." |
paul@288 | 38 | |
paul@288 | 39 | def __init__(self, key): |
paul@288 | 40 | self.key = key |
paul@288 | 41 | |
paul@470 | 42 | class RuntimeError(Exception): |
paul@470 | 43 | |
paul@470 | 44 | "A general runtime error." |
paul@470 | 45 | |
paul@470 | 46 | pass |
paul@470 | 47 | |
paul@470 | 48 | class NotImplementedError(RuntimeError): |
paul@468 | 49 | |
paul@468 | 50 | "An error indicating an unimplemented function or method." |
paul@468 | 51 | |
paul@468 | 52 | def __init__(self, name): |
paul@468 | 53 | self.name = name |
paul@468 | 54 | |
paul@468 | 55 | class StopIteration(Exception): |
paul@468 | 56 | |
paul@468 | 57 | "An exception signalling the end of iteration." |
paul@468 | 58 | |
paul@468 | 59 | pass |
paul@281 | 60 | |
paul@281 | 61 | class ValueError(Exception): |
paul@281 | 62 | |
paul@281 | 63 | "An error concerned with a particular value." |
paul@281 | 64 | |
paul@281 | 65 | def __init__(self, value): |
paul@281 | 66 | self.value = value |
paul@6 | 67 | |
paul@6 | 68 | # vim: tabstop=4 expandtab shiftwidth=4 |