Enum Class DBusError
- All Implemented Interfaces:
Enumeration
,Serializable
,Comparable<DBusError>
,Constable
G_DBUS_ERROR
error domain.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionSecurity restrictions don't allow doing what you're trying to do.Can't bind a socket since its address is in use (i.e.Asked for ADT audit data and it wasn't available.Authentication didn't work.A D-Bus bus address was malformed.The connection is disconnected and you're trying to use it.A generic error; "something went wrong" - see the error message for more.Existing file and the operation you're using does not silently overwrite.Missing file.Invalid arguments passed to a method call.A file contains invalid syntax or is otherwise broken.A type signature is not valid.Something went wrong reading or writing to a socket, for example.Some limited resource is exhausted.The match rule isn't syntactically valid.Tried to remove or modify a match rule that didn't exist.The bus name you referenced doesn't exist (i.e.There was not enough memory to complete an operation.No network access (probably ENETUNREACH on a socket).No reply to a message expecting one, usually means a timeout occurred.Unable to connect to server (probably caused by ECONNREFUSED on a socket).Requested operation isn't supported (like ENOSYS on UNIX).There's already an object with the requested object path.Property you tried to set is read-only.Asked for SELinux security context and it wasn't available.The bus doesn't know how to launch a service to supply the bus name you wanted.While starting a new process, the child exited with a status code.While starting a new process, the child exited on a signal.We failed to setup the config parser correctly.While starting a new process, the exec() call failed.While starting a new process, something went wrong.Service file invalid (Name, User or Exec missing).While starting a new process, the fork() call failed.Tried to get a UNIX process ID and it wasn't available.Permissions are incorrect on the setuid helper.Bus name was not valid.Service file not found in system-services directory.We failed to setup the environment correctly.Certain timeout errors, e.g.Certain timeout errors, possibly ETIMEDOUT on a socket.Tried to get a UNIX process ID and it wasn't available.Interface you invoked a method on isn't known by the object.Method name you invoked isn't known by the object you invoked it on.Object you invoked a method on isn't known.Property you tried to access isn't known by the object. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
encodeGerror
(GError error) Creates a D-Bus error name to use forerror
.static String
getRemoteError
(GError error) Gets the D-Bus error name used forerror
, if any.static Type
getType()
Get the GType of the DBusError classint
getValue()
Get the numeric value of this enumstatic boolean
isRemoteError
(GError error) Checks iferror
represents an error received via D-Bus from a remote peer.static GError
newForDbusError
(String dbusErrorName, String dbusErrorMessage) Creates aGError
based on the contents ofdbusErrorName
anddbusErrorMessage
.static DBusError
of
(int value) Create a new DBusError for the provided valuestatic Quark
quark()
static boolean
registerError
(Quark errorDomain, int errorCode, String dbusErrorName) Creates an association to map betweendbusErrorName
andGErrors
specified byerrorDomain
anderrorCode
.static void
registerErrorDomain
(String errorDomainQuarkName, MemorySegment quarkVolatile, DBusErrorEntry[] entries) Helper function for associating aGError
error domain with D-Bus error names.static void
setDbusError
(GError[] error, String dbusErrorName, String dbusErrorMessage, @Nullable String format, Object... varargs) Does nothing iferror
isnull
.static boolean
stripRemoteError
(GError error) Looks for extra information in the error message used to recover the D-Bus error name and strips it if found.static boolean
unregisterError
(Quark errorDomain, int errorCode, String dbusErrorName) Destroys an association previously set up with g_dbus_error_register_error().static DBusError
Returns the enum constant of this class with the specified name.static DBusError[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
FAILED
A generic error; "something went wrong" - see the error message for more. -
NO_MEMORY
There was not enough memory to complete an operation. -
SERVICE_UNKNOWN
The bus doesn't know how to launch a service to supply the bus name you wanted. -
NAME_HAS_NO_OWNER
The bus name you referenced doesn't exist (i.e. no application owns it). -
NO_REPLY
No reply to a message expecting one, usually means a timeout occurred. -
IO_ERROR
Something went wrong reading or writing to a socket, for example. -
BAD_ADDRESS
A D-Bus bus address was malformed. -
NOT_SUPPORTED
Requested operation isn't supported (like ENOSYS on UNIX). -
LIMITS_EXCEEDED
Some limited resource is exhausted. -
ACCESS_DENIED
Security restrictions don't allow doing what you're trying to do. -
AUTH_FAILED
Authentication didn't work. -
NO_SERVER
Unable to connect to server (probably caused by ECONNREFUSED on a socket). -
TIMEOUT
-
NO_NETWORK
No network access (probably ENETUNREACH on a socket). -
ADDRESS_IN_USE
Can't bind a socket since its address is in use (i.e. EADDRINUSE). -
DISCONNECTED
The connection is disconnected and you're trying to use it. -
INVALID_ARGS
Invalid arguments passed to a method call. -
FILE_NOT_FOUND
Missing file. -
FILE_EXISTS
Existing file and the operation you're using does not silently overwrite. -
UNKNOWN_METHOD
Method name you invoked isn't known by the object you invoked it on. -
TIMED_OUT
-
MATCH_RULE_NOT_FOUND
Tried to remove or modify a match rule that didn't exist. -
MATCH_RULE_INVALID
The match rule isn't syntactically valid. -
SPAWN_EXEC_FAILED
While starting a new process, the exec() call failed. -
SPAWN_FORK_FAILED
While starting a new process, the fork() call failed. -
SPAWN_CHILD_EXITED
While starting a new process, the child exited with a status code. -
SPAWN_CHILD_SIGNALED
While starting a new process, the child exited on a signal. -
SPAWN_FAILED
While starting a new process, something went wrong. -
SPAWN_SETUP_FAILED
We failed to setup the environment correctly. -
SPAWN_CONFIG_INVALID
We failed to setup the config parser correctly. -
SPAWN_SERVICE_INVALID
Bus name was not valid. -
SPAWN_SERVICE_NOT_FOUND
Service file not found in system-services directory. -
SPAWN_PERMISSIONS_INVALID
Permissions are incorrect on the setuid helper. -
SPAWN_FILE_INVALID
Service file invalid (Name, User or Exec missing). -
SPAWN_NO_MEMORY
Tried to get a UNIX process ID and it wasn't available. -
UNIX_PROCESS_ID_UNKNOWN
Tried to get a UNIX process ID and it wasn't available. -
INVALID_SIGNATURE
A type signature is not valid. -
INVALID_FILE_CONTENT
A file contains invalid syntax or is otherwise broken. -
SELINUX_SECURITY_CONTEXT_UNKNOWN
Asked for SELinux security context and it wasn't available. -
ADT_AUDIT_DATA_UNKNOWN
Asked for ADT audit data and it wasn't available. -
OBJECT_PATH_IN_USE
There's already an object with the requested object path. -
UNKNOWN_OBJECT
Object you invoked a method on isn't known. Since 2.42 -
UNKNOWN_INTERFACE
Interface you invoked a method on isn't known by the object. Since 2.42 -
UNKNOWN_PROPERTY
Property you tried to access isn't known by the object. Since 2.42 -
PROPERTY_READ_ONLY
Property you tried to set is read-only. Since 2.42
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
of
Create a new DBusError for the provided value- Parameters:
value
- the enum value- Returns:
- the enum for the provided value
-
getValue
public int getValue()Get the numeric value of this enum- Specified by:
getValue
in interfaceEnumeration
- Returns:
- the enum value
-
getType
-
encodeGerror
Creates a D-Bus error name to use forerror
. Iferror
matches a registered error (cf. g_dbus_error_register_error()), the corresponding D-Bus error name will be returned.Otherwise the a name of the form
org.gtk.GDBus.UnmappedGError.Quark._ESCAPED_QUARK_NAME.Code_ERROR_CODE
will be used. This allows other GDBus applications to map the error on the wire back to aGError
using g_dbus_error_new_for_dbus_error().This function is typically only used in object mappings to put a
GError
on the wire. Regular applications should not use it.- Parameters:
error
- AGError
.- Returns:
- A D-Bus error name (never
null
). Free with g_free().
-
getRemoteError
Gets the D-Bus error name used forerror
, if any.This function is guaranteed to return a D-Bus error name for all
GErrors
returned from functions handling remote method calls (e.g. g_dbus_connection_call_finish()) unless g_dbus_error_strip_remote_error() has been used onerror
.- Parameters:
error
- aGError
- Returns:
- an allocated string or
null
if the D-Bus error name could not be found. Free with g_free().
-
isRemoteError
Checks iferror
represents an error received via D-Bus from a remote peer. If so, use g_dbus_error_get_remote_error() to get the name of the error.- Parameters:
error
- AGError
.- Returns:
true
iferror
represents an error from a remote peer,false
otherwise.
-
newForDbusError
Creates aGError
based on the contents ofdbusErrorName
anddbusErrorMessage
.Errors registered with g_dbus_error_register_error() will be looked up using
dbusErrorName
and if a match is found, the error domain and code is used. Applications can use g_dbus_error_get_remote_error() to recoverdbusErrorName
.If a match against a registered error is not found and the D-Bus error name is in a form as returned by g_dbus_error_encode_gerror() the error domain and code encoded in the name is used to create the
GError
. Also,dbusErrorName
is added to the error message such that it can be recovered with g_dbus_error_get_remote_error().Otherwise, a
GError
with the error codeIOErrorEnum.DBUS_ERROR
in theG_IO_ERROR
error domain is returned. Also,dbusErrorName
is added to the error message such that it can be recovered with g_dbus_error_get_remote_error().In all three cases,
dbusErrorName
can always be recovered from the returnedGError
using the g_dbus_error_get_remote_error() function (unless g_dbus_error_strip_remote_error() hasn't been used on the returned error).This function is typically only used in object mappings to prepare
GError
instances for applications. Regular applications should not use it.- Parameters:
dbusErrorName
- D-Bus error name.dbusErrorMessage
- D-Bus error message.- Returns:
- An allocated
GError
. Free with g_error_free().
-
quark
-
registerError
Creates an association to map betweendbusErrorName
andGErrors
specified byerrorDomain
anderrorCode
.This is typically done in the routine that returns the
GQuark
for an error domain.- Parameters:
errorDomain
- AGQuark
for an error domain.errorCode
- An error code.dbusErrorName
- A D-Bus error name.- Returns:
true
if the association was created,false
if it already exists.
-
registerErrorDomain
public static void registerErrorDomain(String errorDomainQuarkName, MemorySegment quarkVolatile, DBusErrorEntry[] entries) Helper function for associating aGError
error domain with D-Bus error names.While
quarkVolatile
has avolatile
qualifier, this is a historical artifact and the argument passed to it should not bevolatile
.- Parameters:
errorDomainQuarkName
- The error domain name.quarkVolatile
- A pointer where to store theGQuark
.entries
- A pointer tonumEntries
GDBusErrorEntry
struct items.
-
setDbusError
public static void setDbusError(GError[] error, String dbusErrorName, String dbusErrorMessage, @Nullable @Nullable String format, Object... varargs) Does nothing iferror
isnull
. Otherwise sets *error
to a newGError
created with g_dbus_error_new_for_dbus_error() withdbusErrorMessage
prepend withformat
(unlessnull
).- Parameters:
error
- A pointer to aGError
ornull
.dbusErrorName
- D-Bus error name.dbusErrorMessage
- D-Bus error message.format
- printf()-style format to prepend todbusErrorMessage
ornull
.varargs
- Arguments forformat
.
-
stripRemoteError
Looks for extra information in the error message used to recover the D-Bus error name and strips it if found. If stripped, the message field inerror
will correspond exactly to what was received on the wire.This is typically used when presenting errors to the end user.
- Parameters:
error
- AGError
.- Returns:
true
if information was stripped,false
otherwise.
-
unregisterError
Destroys an association previously set up with g_dbus_error_register_error().- Parameters:
errorDomain
- AGQuark
for an error domain.errorCode
- An error code.dbusErrorName
- A D-Bus error name.- Returns:
true
if the association was destroyed,false
if it wasn't found.
-