zbus/fdo/
error.rs

1use crate::DBusError;
2
3/// Errors from <https://gitlab.freedesktop.org/dbus/dbus/-/blob/master/dbus/dbus-protocol.h>
4#[derive(Clone, Debug, DBusError, PartialEq)]
5#[zbus(prefix = "org.freedesktop.DBus.Error", impl_display = true)]
6#[allow(clippy::upper_case_acronyms)]
7pub enum Error {
8    /// Unknown or fall-through zbus error.
9    #[zbus(error)]
10    ZBus(zbus::Error),
11
12    /// A generic error; "something went wrong" - see the error message for more.
13    Failed(String),
14
15    /// There was not enough memory to complete an operation.
16    NoMemory(String),
17
18    /// The bus doesn't know how to launch a service to supply the bus name you wanted.
19    ServiceUnknown(String),
20
21    /// The bus name you referenced doesn't exist (i.e. no application owns it).
22    NameHasNoOwner(String),
23
24    /// No reply to a message expecting one, usually means a timeout occurred.
25    NoReply(String),
26
27    /// Something went wrong reading or writing to a socket, for example.
28    IOError(String),
29
30    /// A D-Bus bus address was malformed.
31    BadAddress(String),
32
33    /// Requested operation isn't supported (like ENOSYS on UNIX).
34    NotSupported(String),
35
36    /// Some limited resource is exhausted.
37    LimitsExceeded(String),
38
39    /// Security restrictions don't allow doing what you're trying to do.
40    AccessDenied(String),
41
42    /// Authentication didn't work.
43    AuthFailed(String),
44
45    /// Unable to connect to server (probably caused by ECONNREFUSED on a socket).
46    NoServer(String),
47
48    /// Certain timeout errors, possibly ETIMEDOUT on a socket.
49    /// Note that `TimedOut` is used for message reply timeouts.
50    Timeout(String),
51
52    /// No network access (probably ENETUNREACH on a socket).
53    NoNetwork(String),
54
55    /// Can't bind a socket since its address is in use (i.e. EADDRINUSE).
56    AddressInUse(String),
57
58    /// The connection is disconnected and you're trying to use it.
59    Disconnected(String),
60
61    /// Invalid arguments passed to a method call.
62    InvalidArgs(String),
63
64    /// Missing file.
65    FileNotFound(String),
66
67    /// Existing file and the operation you're using does not silently overwrite.
68    FileExists(String),
69
70    /// Method name you invoked isn't known by the object you invoked it on.
71    UnknownMethod(String),
72
73    /// Object you invoked a method on isn't known.
74    UnknownObject(String),
75
76    /// Interface you invoked a method on isn't known by the object.
77    UnknownInterface(String),
78
79    /// Property you tried to access isn't known by the object.
80    UnknownProperty(String),
81
82    /// Property you tried to set is read-only.
83    PropertyReadOnly(String),
84
85    /// Certain timeout errors, e.g. while starting a service.
86    TimedOut(String),
87
88    /// Tried to remove or modify a match rule that didn't exist.
89    MatchRuleNotFound(String),
90
91    /// The match rule isn't syntactically valid.
92    MatchRuleInvalid(String),
93
94    /// While starting a new process, the exec() call failed.
95    #[zbus(name = "Spawn.ExecFailed")]
96    SpawnExecFailed(String),
97
98    /// While starting a new process, the fork() call failed.
99    #[zbus(name = "Spawn.ForkFailed")]
100    SpawnForkFailed(String),
101
102    /// While starting a new process, the child exited with a status code.
103    #[zbus(name = "Spawn.ChildExited")]
104    SpawnChildExited(String),
105
106    /// While starting a new process, the child exited on a signal.
107    #[zbus(name = "Spawn.ChildSignaled")]
108    SpawnChildSignaled(String),
109
110    /// While starting a new process, something went wrong.
111    #[zbus(name = "Spawn.Failed")]
112    SpawnFailed(String),
113
114    /// We failed to set up the environment correctly.
115    #[zbus(name = "Spawn.FailedToSetup")]
116    SpawnFailedToSetup(String),
117
118    /// We failed to set up the config parser correctly.
119    #[zbus(name = "Spawn.ConfigInvalid")]
120    SpawnConfigInvalid(String),
121
122    /// Bus name was not valid.
123    #[zbus(name = "Spawn.ServiceNotValid")]
124    SpawnServiceNotValid(String),
125
126    /// Service file not found in system-services directory.
127    #[zbus(name = "Spawn.ServiceNotFound")]
128    SpawnServiceNotFound(String),
129
130    /// Permissions are incorrect on the setuid helper.
131    #[zbus(name = "Spawn.PermissionsInvalid")]
132    SpawnPermissionsInvalid(String),
133
134    /// Service file invalid (Name, User or Exec missing).
135    #[zbus(name = "Spawn.FileInvalid")]
136    SpawnFileInvalid(String),
137
138    /// There was not enough memory to complete the operation.
139    #[zbus(name = "Spawn.NoMemory")]
140    SpawnNoMemory(String),
141
142    /// Tried to get a UNIX process ID and it wasn't available.
143    UnixProcessIdUnknown(String),
144
145    /// A type signature is not valid.
146    InvalidSignature(String),
147
148    /// A file contains invalid syntax or is otherwise broken.
149    InvalidFileContent(String),
150
151    /// Asked for SELinux security context and it wasn't available.
152    SELinuxSecurityContextUnknown(String),
153
154    /// Asked for ADT audit data and it wasn't available.
155    AdtAuditDataUnknown(String),
156
157    /// There's already an object with the requested object path.
158    ObjectPathInUse(String),
159
160    /// The message metadata does not match the payload. e.g. expected number of file descriptors
161    /// were not sent over the socket this message was received on.
162    InconsistentMessage(String),
163
164    /// The message is not allowed without performing interactive authorization, but could have
165    /// succeeded if an interactive authorization step was allowed.
166    InteractiveAuthorizationRequired(String),
167
168    /// The connection is not from a container, or the specified container instance does not exist.
169    NotContainer(String),
170}
171
172/// Alias for a `Result` with the error type [`zbus::fdo::Error`].
173///
174/// [`zbus::fdo::Error`]: enum.Error.html
175pub type Result<T> = std::result::Result<T, Error>;