X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=a1%2Fexceptions.py;h=b7d1244f2f03642fd3b5e45733b0e58b41b6d816;hb=f0ac3fb27a3bda65076f790def3284065c95b098;hp=be113ba4a2a4002250f5808b907dd7262730f36c;hpb=bfa46147cce23a46a49fb53dfae8a790b0fe34e4;p=ric-plt%2Fa1.git diff --git a/a1/exceptions.py b/a1/exceptions.py index be113ba..b7d1244 100644 --- a/a1/exceptions.py +++ b/a1/exceptions.py @@ -19,13 +19,29 @@ Custom Exceptions """ -class PolicyInstanceNotFound(BaseException): +class A1Error(Exception): + """A base class for A1 exceptions.""" + + def __init__(self, message): + # Call the base class constructor with the parameters it needs + super(A1Error, self).__init__(message) + + +class CantDeleteNonEmptyType(A1Error): + """tried to delete a type that isn't empty""" + + +class PolicyInstanceNotFound(A1Error): """a policy instance cannot be found""" -class PolicyTypeNotFound(BaseException): +class PolicyTypeNotFound(A1Error): """a policy type instance cannot be found""" -class PolicyTypeAlreadyExists(BaseException): +class PolicyTypeAlreadyExists(A1Error): """a policy type already exists and replace not supported at this time""" + + +class PolicyTypeIdMismatch(A1Error): + """a policy type request path ID differs from its body ID"""