2 # This file is part of the GROMACS molecular simulation package.
4 # Copyright (c) 2019, by the GROMACS development team, led by
5 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 # and including many others, as listed in the AUTHORS file in the
7 # top-level source directory and at http://www.gromacs.org.
9 # GROMACS is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public License
11 # as published by the Free Software Foundation; either version 2.1
12 # of the License, or (at your option) any later version.
14 # GROMACS is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with GROMACS; if not, see
21 # http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 # If you want to redistribute modifications to GROMACS, please
25 # consider that scientific software is very special. Version
26 # control is crucial - bugs must be traceable. We will be happy to
27 # consider code for inclusion in the official distribution, but
28 # derived work must not be called official GROMACS. Details are found
29 # in the README & COPYING files - if they are missing, get the
30 # official version at http://www.gromacs.org.
32 # To help us fund GROMACS development, we humbly ask that you cite
33 # the research papers on the package. Check out http://www.gromacs.org.
36 Exceptions and Warnings raised by gmxapi module operations.
38 Errors, warnings, and other exceptions used in the GROMACS
39 Python package are defined in the `exceptions` submodule.
41 The gmxapi Python package defines a root exception,
42 exceptions.Error, from which all Exceptions thrown from
43 within the module should derive. If a published component of
44 the gmxapi package throws an exception that cannot be caught
45 as a gmxapi.exceptions.Error, please report the bug.
48 __all__
= ['ApiError',
51 'FeatureNotAvailableError',
52 'NotImplementedError',
61 class Error(Exception):
62 """Base exception for gmx.exceptions classes."""
65 class Warning(Warning):
66 """Base warning class for gmx.exceptions."""
69 class ApiError(Error
):
70 """An API operation was attempted with an incompatible object."""
73 class DataShapeError(Error
):
74 """An object has an incompatible shape.
76 This exception does not imply that the Type or any other aspect of the data
81 class NotImplementedError(Error
):
82 """Specified feature is not implemented in the current code.
84 This exception indicates that the implemented code does not support the
85 API as specified. The calling code has used valid syntax, as documented for
86 the API, but has reached incompletely implemented code, which should be
89 # May be useful for error checking in base classes or as a development tool
90 # to avoid releasing incomplete implementations (e.g. overlooked "To do"s)
93 class FeatureNotAvailableError(Error
):
94 """Requested feature not available in the current environment.
96 This exception will usually indicate an issue with the user's environment or
97 run time details. There may be a missing optional dependency, which should
98 be specified in the exception message.
102 class ProtocolError(Error
):
103 """Unexpected API behavior or protocol violation.
105 This exception generally indicates a gmxapi bug, since it should only
106 occur through incorrect assumptions or misuse of API implementation internals.
110 class TypeError(Error
):
111 """Incompatible type for gmxapi data.
113 Reference datamodel.rst for more on gmxapi data typing.
117 class UsageError(Error
):
118 """Unsupported syntax or call signatures.
120 Generic usage error for gmxapi module.
124 class ValueError(Error
):
125 """A user-provided value cannot be interpreted or doesn't make sense."""