]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/nfs/exception.py
import ceph pacific 16.2.5
[ceph.git] / ceph / src / pybind / mgr / nfs / exception.py
1 import errno
2
3
4 class NFSException(Exception):
5 def __init__(self, errno, err_msg):
6 super(NFSException, self).__init__(errno, err_msg)
7 self.errno = errno
8 self.err_msg = err_msg
9
10 def __str__(self):
11 return self.err_msg
12
13
14 class NFSInvalidOperation(NFSException):
15 def __init__(self, err_msg):
16 super(NFSInvalidOperation, self).__init__(-errno.EINVAL, err_msg)
17
18
19 class NFSObjectNotFound(NFSException):
20 def __init__(self, err_msg):
21 super(NFSObjectNotFound, self).__init__(-errno.ENOENT, err_msg)
22
23
24 class FSNotFound(NFSObjectNotFound):
25 def __init__(self, fs_name):
26 super(FSNotFound, self).__init__(f'filesystem {fs_name} not found')
27
28
29 class ClusterNotFound(NFSObjectNotFound):
30 def __init__(self):
31 super(ClusterNotFound, self).__init__('cluster does not exist')