Couple more checkout related functions
[public/library.git] / exceptions.py
1 import abc
2
3 class LibrarianException(Exception, metaclass=abc.ABCMeta):
4     @abc.abstractproperty
5     def error_msg(self):
6         pass
7
8     def __str__(self):
9         return self.error_msg
10
11 class PermissionsError(LibrarianException):
12     def __init__(self, permission_string):
13         self.permission_string = permission_string
14
15     @property
16     def error_msg(self):
17         return "Need privilege level {}".format(self.permission_string)