Coverage for python/lsst/daf/butler/registry/_exceptions.py: 100%
20 statements
« prev ^ index » next coverage.py v6.5.0, created at 2022-11-17 02:01 -0800
« prev ^ index » next coverage.py v6.5.0, created at 2022-11-17 02:01 -0800
1# This file is part of daf_butler.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (http://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program 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
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
23__all__ = (
24 "ArgumentError",
25 "CollectionError",
26 "CollectionExpressionError",
27 "CollectionTypeError",
28 "ConflictingDefinitionError",
29 "DataIdError",
30 "DataIdValueError",
31 "DatasetTypeError",
32 "DatasetTypeExpressionError",
33 "DimensionNameError",
34 "InconsistentDataIdError",
35 "MissingCollectionError",
36 "MissingDatasetTypeError",
37 "NoDefaultCollectionError",
38 "OrphanedRecordError",
39 "RegistryError",
40 "UnsupportedIdGeneratorError",
41 "UserExpressionError",
42 "UserExpressionSyntaxError",
43)
46class RegistryError(Exception):
47 """Base class for many exception classes produced by Registry methods.
49 Notes
50 -----
51 The client code that needs to handle exceptions generated by the Registry
52 methods can catch this class or one of its many subclasses as described by
53 the particular method documentation. While most of the Registry methods
54 should only raise the exceptions of this type, it is hard to guarantee
55 that they will never raise other exception types. If the client needs to
56 handle all possible exceptions, then it should also catch a standard
57 `Exception` type as well. Additionally, some Registry methods can be
58 explicitly documented to raise exceptions outside this class hierarchy.
59 """
62class ArgumentError(RegistryError):
63 """Exception raised when method arguments are invalid or inconsistent."""
66class DatasetTypeError(RegistryError):
67 """Exception raised for problems with dataset types."""
70class MissingDatasetTypeError(DatasetTypeError, KeyError):
71 """Exception raised when a dataset type does not exist."""
74class DatasetTypeExpressionError(RegistryError):
75 """Exception raised for an incorrect dataset type expression."""
78class DataIdError(RegistryError):
79 """Exception raised for incorrect data IDs, this is a base class for other
80 specific error types.
81 """
84class DimensionNameError(DataIdError):
85 """Exception raised when a dimension specified in a data ID does not exist
86 or required dimension is not provided.
87 """
90class DataIdValueError(DataIdError):
91 """Exception raised when a value specified in a data ID does not exist."""
94class InconsistentDataIdError(DataIdError):
95 """Exception raised when a data ID contains contradictory key-value pairs,
96 according to dimension relationships.
97 """
100class CollectionError(RegistryError):
101 """Exception raised for collection-related errors."""
104class CollectionTypeError(CollectionError):
105 """Exception raised when type of a collection is incorrect."""
108class CollectionExpressionError(CollectionError):
109 """Exception raised for an incorrect collection expression."""
112class MissingCollectionError(CollectionError):
113 """Exception raised when an operation attempts to use a collection that
114 does not exist.
115 """
118class NoDefaultCollectionError(CollectionError):
119 """Exception raised when a collection is needed, but collection argument
120 is not provided and default collection is not defined in registry.
121 """
124class UserExpressionError(RegistryError):
125 """Exception raised for problems with user expression."""
128class UserExpressionSyntaxError(UserExpressionError):
129 """Exception raised when a user query expression cannot be parsed."""
132class ConflictingDefinitionError(RegistryError):
133 """Exception raised when trying to insert a database record when a
134 conflicting record already exists.
135 """
138class OrphanedRecordError(RegistryError):
139 """Exception raised when trying to remove or modify a database record
140 that is still being used in some other table.
141 """
144class UnsupportedIdGeneratorError(ValueError):
145 """Exception raised when an unsupported `DatasetIdGenEnum` option is
146 used for insert/import.
147 """