| 1 |
|
| 2 |
""" |
| 3 |
Copyright (c) 2018 Rolf Hempel, [email protected] |
| 4 |
|
| 5 |
This file is part of the PlanetarySystemStacker tool (PSS). |
| 6 |
https://github.com/Rolf-Hempel/PlanetarySystemStacker |
| 7 |
|
| 8 |
PSS is free software: you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation, either version 3 of the License, or |
| 11 |
(at your option) any later version. |
| 12 |
|
| 13 |
This program is distributed in the hope that it will be useful, |
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
GNU General Public License for more details. |
| 17 |
|
| 18 |
You should have received a copy of the GNU General Public License |
| 19 |
along with PSS. If not, see <http://www.gnu.org/licenses/>. |
| 20 |
|
| 21 |
""" |
| 22 |
|
| 23 |
class Error(Exception): |
| 24 |
"""Base class for exceptions in this module. |
| 25 |
|
| 26 |
Attributes: |
| 27 |
message -- explanation of the error |
| 28 |
""" |
| 29 |
|
| 30 |
def __init__(self, message): |
| 31 |
self.message = message |
| 32 |
|
| 33 |
class TypeError(Error): |
| 34 |
"""Exception raised for type errors during input. |
| 35 |
|
| 36 |
Attributes: |
| 37 |
message -- explanation of the error |
| 38 |
""" |
| 39 |
|
| 40 |
def __init__(self, message): |
| 41 |
super(TypeError, self).__init__(message) |
| 42 |
|
| 43 |
class ShapeError(Error): |
| 44 |
"""Exception raised if image shapes do not match during input. |
| 45 |
|
| 46 |
Attributes: |
| 47 |
message -- explanation of the error |
| 48 |
""" |
| 49 |
|
| 50 |
def __init__(self, message): |
| 51 |
super(ShapeError, self).__init__(message) |
| 52 |
|
| 53 |
class NotSupportedError(Error): |
| 54 |
"""Exception raised if a method is called which is not implemented yet. |
| 55 |
|
| 56 |
Attributes: |
| 57 |
message -- explanation of the error |
| 58 |
""" |
| 59 |
|
| 60 |
def __init__(self, message): |
| 61 |
super(NotSupportedError, self).__init__(message) |
| 62 |
|
| 63 |
class ArgumentError(Error): |
| 64 |
"""Exception raised if a method is called which an invalid argument. |
| 65 |
|
| 66 |
Attributes: |
| 67 |
message -- explanation of the error |
| 68 |
""" |
| 69 |
|
| 70 |
def __init__(self, message): |
| 71 |
super(ArgumentError, self).__init__(message) |
| 72 |
|
| 73 |
class WrongOrderingError(Error): |
| 74 |
"""Exception raised if a method is called before required input is available. |
| 75 |
|
| 76 |
Attributes: |
| 77 |
message -- explanation of the error |
| 78 |
""" |
| 79 |
|
| 80 |
def __init__(self, message): |
| 81 |
super(WrongOrderingError, self).__init__(message) |
| 82 |
|
| 83 |
class InternalError(Error): |
| 84 |
"""Exception raised if an internal error occurred which should never happen. |
| 85 |
|
| 86 |
Attributes: |
| 87 |
message -- explanation of the error |
| 88 |
""" |
| 89 |
|
| 90 |
def __init__(self, message): |
| 91 |
super(InternalError, self).__init__(message) |
| 92 |
|
| 93 |
class DivideByZeroError(Error): |
| 94 |
"""Exception raised if an attempt is made to divide by zero. |
| 95 |
|
| 96 |
Attributes: |
| 97 |
message -- explanation of the error |
| 98 |
""" |
| 99 |
|
| 100 |
def __init__(self, message): |
| 101 |
super(DivideByZeroError, self).__init__(message) |
| 102 |
|
| 103 |
class IncompatibleVersionsError(Error): |
| 104 |
"""Exception raised if data and program versions do not match. |
| 105 |
|
| 106 |
Attributes: |
| 107 |
message -- explanation of the error |
| 108 |
""" |
| 109 |
|
| 110 |
def __init__(self, message): |
| 111 |
super(IncompatibleVersionsError, self).__init__(message) |