Revise custom exceptions to require a message
[ric-plt/a1.git] / a1 / exceptions.py
1 # ==================================================================================
2 #       Copyright (c) 2019 Nokia
3 #       Copyright (c) 2018-2019 AT&T Intellectual Property.
4 #
5 #   Licensed under the Apache License, Version 2.0 (the "License");
6 #   you may not use this file except in compliance with the License.
7 #   You may obtain a copy of the License at
8 #
9 #          http://www.apache.org/licenses/LICENSE-2.0
10 #
11 #   Unless required by applicable law or agreed to in writing, software
12 #   distributed under the License is distributed on an "AS IS" BASIS,
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 #   See the License for the specific language governing permissions and
15 #   limitations under the License.
16 # ==================================================================================
17 """
18 Custom Exceptions
19 """
20
21
22 class A1Error(Exception):
23     """A base class for A1 exceptions."""
24
25     def __init__(self, message):
26         # Call the base class constructor with the parameters it needs
27         super(A1Error, self).__init__(message)
28
29
30 class CantDeleteNonEmptyType(A1Error):
31     """tried to delete a type that isn't empty"""
32
33
34 class PolicyInstanceNotFound(A1Error):
35     """a policy instance cannot be found"""
36
37
38 class PolicyTypeNotFound(A1Error):
39     """a policy type instance cannot be found"""
40
41
42 class PolicyTypeAlreadyExists(A1Error):
43     """a policy type already exists and replace not supported at this time"""
44
45
46 class PolicyTypeIdMismatch(A1Error):
47     """a policy type request path ID differs from its body ID"""