forked from nmstate/nmstate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.py
131 lines (92 loc) · 2.87 KB
/
error.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#
# Copyright (c) 2019-2020 Red Hat, Inc.
#
# This file is part of nmstate
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 2.1 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
class NmstateError(Exception):
"""
The base exception of libnmstate.
"""
pass
class NmstateDependencyError(NmstateError):
"""
Nmstate requires external tools installed and/or started for desired state.
"""
pass
class NmstateValueError(NmstateError, ValueError):
"""
Exception happens at pre-apply check, user should resubmit the amended
desired state. Example:
* JSON/YAML syntax issue.
* Nmstate schema issue.
* Invalid value of desired property, like bond missing port.
"""
pass
class NmstatePermissionError(NmstateError, PermissionError):
"""
Permission deny when applying the desired state.
"""
pass
class NmstateConflictError(NmstateError, RuntimeError):
"""
Something else is already editing the network state via Nmstate.
"""
pass
class NmstateLibnmError(NmstateError):
"""
Exception for unexpected libnm failure.
"""
pass
class NmstateVerificationError(NmstateError):
"""
After applied desired state, current state does not match desired state for
unknown reason.
"""
pass
class NmstateKernelIntegerRoundedError(NmstateVerificationError):
"""
After applied desired state, current state does not match desire state
due to integer been rounded by kernel.
For example, with HZ configured as 250 in kernel, the linux bridge option
multicast_startup_query_interval, 3125 will be rounded to 3124.
"""
pass
class NmstateNotImplementedError(NmstateError, NotImplementedError):
"""
Desired feature is not supported by Nmstate yet.
"""
pass
class NmstateInternalError(NmstateError):
"""
Unexpected behaviour happened. It is a bug of libnmstate which should be
fixed.
"""
pass
class NmstateNotSupportedError(NmstateError):
"""
A resource like a device does not support the requested feature.
"""
pass
class NmstateTimeoutError(NmstateLibnmError):
"""
The transaction execution timed out.
"""
pass
class NmstatePluginError(NmstateError):
"""
Unexpected plugin behaviour happens, it is a bug of the plugin.
"""
pass