Package io.github.jwharm.javagi.base
Class GErrorException
java.lang.Object
java.lang.Throwable
java.lang.Exception
io.github.jwharm.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
ConstructorDescriptionGErrorException
(MemorySegment gerrorPtr) Create a GErrorException from a GError memory segment that was returned by a native function.GErrorException
(Quark domain, int code, String message, 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 TypeMethodDescriptionint
getCode()
Get the error code.Get the error domain.Deprecated.static boolean
isErrorSet
(MemorySegment gerrorPtr) Check if an error is set.toGError()
Create a new GError instance with the domain, code and message of this GErrorException.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
GErrorException
Create a GErrorException from a GError memory segment that was returned by a native function.- Parameters:
gerrorPtr
- pointer to 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
-
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.- Returns:
- a newly created GError instance
-
getGError
Deprecated.seetoGError()
Create a new GError instance with the domain, code and message of this GErrorException.- Returns:
- a newly created GError instance
-
toGError()