Add implementation of SDL in python
[ric-plt/sdlpy.git] / ricsdl-package / ricsdl / exceptions.py
1 # Copyright (c) 2019 AT&T Intellectual Property.
2 # Copyright (c) 2018-2019 Nokia.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 #
17 # This source code is part of the near-RT RIC (RAN Intelligent Controller)
18 # platform project (RICP).
19 #
20
21
22 "Exceptions raised by the Shared Data Layer (SDL)."
23
24
25 class SdlTypeError(TypeError):
26     """
27     Exception for passing a function argument of wrong type.
28     It is likely that the same request will fail repeatedly. It is advised to investigate the exact
29     reason for the failure from the logs.
30     """
31     pass
32
33
34 class SdlException(Exception):
35     """Base exception class for Shared Data Layer (SDL) exceptions."""
36     pass
37
38
39 class NotConnected(SdlException):
40     """
41     Exception for SDL not being connected to the database backend.
42     SDL is not connected to the backend data storage and therefore could not deliver the request
43     to the backend data storage. Data in the backend data storage has not been altered.
44     Client is advised to try the operation again later.
45     """
46     pass
47
48
49 class BackendError(SdlException):
50     """
51     Exception for request processing failure in SDL database backend.
52     In case of a write type request, data in the backend data storage may or may not have been
53     altered. Client is advised to try the operation again later.
54     """
55     pass
56
57
58 class RejectedByBackend(SdlException):
59     """
60     Exception for SDL database backend rejecting the request.
61     Backend data storage rejected the request. In case of a write type request, data in the backend
62     data storage may or may not have been altered. It is likely that the same request will fail
63     repeatedly. It is advised to investigate the exact reason for the failure from the logs.
64     """
65     pass