Coverage for python/lsst/daf/butler/registry/_exceptions.py: 100%
19 statements
« prev ^ index » next coverage.py v6.4.4, created at 2022-09-27 01:59 -0700
« prev ^ index » next coverage.py v6.4.4, created at 2022-09-27 01:59 -0700
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 "NoDefaultCollectionError",
37 "OrphanedRecordError",
38 "RegistryError",
39 "UnsupportedIdGeneratorError",
40 "UserExpressionError",
41 "UserExpressionSyntaxError",
42)
45class RegistryError(Exception):
46 """Base class for many exception classes produced by Registry methods.
48 Notes
49 -----
50 The client code that needs to handle exceptions generated by the Registry
51 methods can catch this class or one of its many subclasses as described by
52 the particular method documentation. While most of the Registry methods
53 should only raise the exceptions of this type, it is hard to guarantee
54 that they will never raise other exception types. If the client needs to
55 handle all possible exceptions, then it should also catch a standard
56 `Exception` type as well. Additionally, some Registry methods can be
57 explicitly documented to raise exceptions outside this class hierarchy.
58 """
61class ArgumentError(RegistryError):
62 """Exception raised when method arguments are invalid or inconsistent."""
65class DatasetTypeError(RegistryError):
66 """Exception raised for problems with dataset types."""
69class DatasetTypeExpressionError(RegistryError):
70 """Exception raised for an incorrect dataset type expression."""
73class DataIdError(RegistryError):
74 """Exception raised for incorrect data IDs, this is a base class for other
75 specific error types.
76 """
79class DimensionNameError(DataIdError):
80 """Exception raised when a dimension specified in a data ID does not exist
81 or required dimension is not provided.
82 """
85class DataIdValueError(DataIdError):
86 """Exception raised when a value specified in a data ID does not exist."""
89class InconsistentDataIdError(DataIdError):
90 """Exception raised when a data ID contains contradictory key-value pairs,
91 according to dimension relationships.
92 """
95class CollectionError(RegistryError):
96 """Exception raised for collection-related errors."""
99class CollectionTypeError(CollectionError):
100 """Exception raised when type of a collection is incorrect."""
103class CollectionExpressionError(CollectionError):
104 """Exception raised for an incorrect collection expression."""
107class MissingCollectionError(CollectionError):
108 """Exception raised when an operation attempts to use a collection that
109 does not exist.
110 """
113class NoDefaultCollectionError(CollectionError):
114 """Exception raised when a collection is needed, but collection argument
115 is not provided and default collection is not defined in registry.
116 """
119class UserExpressionError(RegistryError):
120 """Exception raised for problems with user expression."""
123class UserExpressionSyntaxError(UserExpressionError):
124 """Exception raised when a user query expression cannot be parsed."""
127class ConflictingDefinitionError(RegistryError):
128 """Exception raised when trying to insert a database record when a
129 conflicting record already exists.
130 """
133class OrphanedRecordError(RegistryError):
134 """Exception raised when trying to remove or modify a database record
135 that is still being used in some other table.
136 """
139class UnsupportedIdGeneratorError(ValueError):
140 """Exception raised when an unsupported `DatasetIdGenEnum` option is
141 used for insert/import.
142 """