Enum Class DBusError
- All Implemented Interfaces:
Serializable,Comparable<DBusError>,Constable,Enumeration
G_DBUS_ERROR error domain.- Since:
- 2.26
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum 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 StringencodeGerror(GError error) Creates a D-Bus error name to use forerror.static @Nullable StringgetRemoteError(GError error) Gets the D-Bus error name used forerror,if any.static @Nullable TypegetType()Get the GType of the DBusError classintgetValue()Get the numeric value of this enumstatic booleanisRemoteError(GError error) Checks iferrorrepresents an error received via D-Bus from a remote peer.static GErrornewForDbusError(String dbusErrorName, String dbusErrorMessage) Creates aGLib.Errorbased on the contents ofdbusErrorNameanddbusErrorMessage.static DBusErrorof(int value) Create a new DBusError for the provided valuestatic DBusErrorof(MemorySegment address) Create a new DBusError for the value in the provided memory address.static Quarkquark()static booleanregisterError(Quark errorDomain, int errorCode, String dbusErrorName) Creates an association mapping betweendbusErrorNameandGLib.Errors specified byerrorDomainanderrorCode.static voidregisterErrorDomain(String errorDomainQuarkName, MemorySegment quarkVolatile, @Nullable DBusErrorEntry @Nullable [] entries) Helper function for associating aGLib.Errorerror domain with D-Bus error names.static voidsetDbusError(Out<GError> error, String dbusErrorName, String dbusErrorMessage, @Nullable String format, Object... varargs) static booleanstripRemoteError(GError error) Looks for extra information in the error message used to recover the D-Bus error name and strips it if found.static booleanunregisterError(Quark errorDomain, int errorCode, String dbusErrorName) Destroys an association previously set up withregisterError(org.gnome.glib.Quark, int, java.lang.String).static DBusErrorReturns 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:
getValuein interfaceEnumeration- Returns:
- the enum value
-
of
Create a new DBusError for the value in the provided memory address.- Parameters:
address- the memory address holding a enum value- Returns:
- the enum for the value in the provided memory address
-
getType
-
encodeGerror
Creates a D-Bus error name to use forerror.If
errormatches a registered error (seeregisterError(org.gnome.glib.Quark, int, java.lang.String)), 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_CODEwill be used. This allows other GDBus applications to map the error on the wire back to aGLib.ErrorusingnewForDbusError(java.lang.String, java.lang.String).This function is typically only used in object mappings to put a
GLib.Erroron the wire. Regular applications should not use it.- Parameters:
error- an error- Returns:
- a D-Bus error name
- Since:
- 2.26
-
getRemoteError
Gets the D-Bus error name used forerror,if any.This function is guaranteed to return a D-Bus error name for all
GLib.Errors returned from functions handling remote method calls (for example,DBusConnection.callFinish(org.gnome.gio.AsyncResult)) unlessstripRemoteError(org.gnome.glib.GError)has already been used onerror.- Parameters:
error- an error- Returns:
- an allocated string, or
NULLif the D-Bus error name could not be found - Since:
- 2.26
-
isRemoteError
Checks iferrorrepresents an error received via D-Bus from a remote peer.If so, use
getRemoteError(org.gnome.glib.GError)to get the name of the error.- Parameters:
error- an error- Returns:
- true if
errorrepresents an error from a remote peer; false otherwise - Since:
- 2.26
-
newForDbusError
Creates aGLib.Errorbased on the contents ofdbusErrorNameanddbusErrorMessage.Errors registered with
registerError(org.gnome.glib.Quark, int, java.lang.String)will be looked up usingdbusErrorNameand if a match is found, the error domain and code is used. Applications can usegetRemoteError(org.gnome.glib.GError)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
encodeGerror(org.gnome.glib.GError)the error domain and code encoded in the name is used to create theGLib.Error. Also,dbusErrorNameis added to the error message such that it can be recovered withgetRemoteError(org.gnome.glib.GError).Otherwise, a
GLib.Errorwith the error codeGio.IOErrorEnum.DBUS_ERRORin theGio.IOErrorEnumerror domain is returned. Also,dbusErrorNameis added to the error message such that it can be recovered withgetRemoteError(org.gnome.glib.GError).In all three cases,
dbusErrorNamecan always be recovered from the returnedGLib.Errorusing thegetRemoteError(org.gnome.glib.GError)function (unlessstripRemoteError(org.gnome.glib.GError)hasn’t been used on the returned error).This function is typically only used in object mappings to prepare
GLib.Errorinstances for applications. Regular applications should not use it.- Parameters:
dbusErrorName- D-Bus error namedbusErrorMessage- D-Bus error message- Returns:
- an allocated
GLib.Error - Since:
- 2.26
-
quark
-
registerError
Creates an association mapping betweendbusErrorNameandGLib.Errors specified byerrorDomainanderrorCode.This is typically done in the function that returns the
GLib.Quarkfor an error domain.- Parameters:
errorDomain- aGLib.Quarkfor an error domainerrorCode- an error codedbusErrorName- a D-Bus error name- Returns:
- true if the association was created, false if it already exists
- Since:
- 2.26
-
registerErrorDomain
public static void registerErrorDomain(String errorDomainQuarkName, MemorySegment quarkVolatile, @Nullable DBusErrorEntry @Nullable [] entries) Helper function for associating aGLib.Errorerror domain with D-Bus error names.While
quarkVolatilehas avolatilequalifier, this is a historical artifact and the argument passed to it should not bevolatile.- Parameters:
errorDomainQuarkName- the error domain namequarkVolatile- return location for theGLib.Quarkrepresenting the error domainentries- items to register- Since:
- 2.26
-
setDbusError
public static void setDbusError(Out<GError> error, String dbusErrorName, String dbusErrorMessage, @Nullable String format, Object... varargs) Sets*errorto a newGLib.Errorcreated withnewForDbusError(java.lang.String, java.lang.String).If
formatis non-NULLthen it is prepended todbusErrorMessage.OtherwisedbusErrorMessageis used unmodified.This function does nothing if
errorisNULL.- Parameters:
error- return location for aGLib.ErrordbusErrorName- D-Bus error namedbusErrorMessage- D-Bus error messageformat-printf()-style format to prepend todbusErrorMessage,orNULLto not modify the messagevarargs- arguments forformat- Since:
- 2.26
-
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 in
errorwill correspond exactly to what was received on the wire.This is typically used when presenting errors to the end user.
- Parameters:
error- an error- Returns:
- true if information was stripped; false otherwise
- Since:
- 2.26
-
unregisterError
Destroys an association previously set up withregisterError(org.gnome.glib.Quark, int, java.lang.String).- Parameters:
errorDomain- aGLib.Quarkfor an error domainerrorCode- an error codedbusErrorName- a D-Bus error name- Returns:
- true if the association was destroyed, false if it wasn’t found
- Since:
- 2.26
-