Class GErrorException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.javagi.base.GErrorException
- All Implemented Interfaces:
Serializable
A GErrorException is thrown when a GError is returned by native code. See
the Gtk
documentation on error reporting for details about GError.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGErrorException(MemorySegment gerrorPtr) Deprecated.GErrorException(GError err) Create a GErrorException from a native GError.GErrorException(Quark domain, int code, @Nullable String message, @Nullable Object... args) Create a GErrorException that can be used to return a GError from a Java callback function to native code. -
Method Summary
Modifier and TypeMethodDescriptionintgetCode()Get the error code.Get the error domain.static booleanisErrorSet(MemorySegment gerrorPtr) Check if an error is set.static GErrorExceptiontake(MemorySegment gerrorPtr) Create a GErrorException from a GError memory location that was returned by a native function.toGError()Create a new GError instance with the domain, code and message of this GErrorException.Create a new GError instance with the domain, code and message of this GErrorException.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
GErrorException
Deprecated.Usetake(MemorySegment)insteadCreate a GErrorException from a GError memory location that was returned by a native function. Consumes (frees) the GError.- Parameters:
gerrorPtr- pointer to a GError in native memory
-
GErrorException
Create a GErrorException from a native GError.- Parameters:
err- a GError in native memory
-
GErrorException
Create a GErrorException that can be used to return a GError from a Java callback function to native code. See the Gtk documentation on error reporting for details.- Parameters:
domain- the GError error domaincode- the GError error codemessage- the error message, printf-style formattedargs- varargs parameters for message format
-
-
Method Details
-
isErrorSet
Check if an error is set.- Parameters:
gerrorPtr- pointer to a GError in native memory- Returns:
- true when an error was set on this pointer
-
take
Create a GErrorException from a GError memory location that was returned by a native function. Consumes (frees) the GError.- Parameters:
gerrorPtr- pointer to a GError in native memory- Returns:
- the newly created GErrorException
-
getCode
public int getCode()Get the error code.- Returns:
- the code of the GError
-
getDomain
-
toGError
Create a new GError instance with the domain, code and message of this GErrorException. The instance will automatically be freed during GC.- Returns:
- a newly created GError instance
-
toGErrorUnowned
Create a new GError instance with the domain, code and message of this GErrorException. The instance will not be automatically freed.- Returns:
- a newly created GError instance
-
take(MemorySegment)instead