org.bridj
Class LastError
java.lang.Object
java.lang.Throwable
java.lang.Error
org.bridj.NativeError
org.bridj.LastError
- All Implemented Interfaces:
- Serializable
public class LastError
- extends NativeError
Native error that correspond to the errno or GetLastError() mechanism.
Some C functions declare errors by marking an error code in errno or through SetLastError(int).
If you want their corresponding bindings to throw an exception whenever such an error was marked, simply make them throw this exception explicitly.
On Windows, BridJ will first check GetLastError(), then if no error was found it will check errno (on the other platforms only errno is available).
For instance, look at the following binding of the C-library strtoul function :
@Library("c")
public static native long strtoul(Pointer<Byte> str, Pointer<Pointer<Byte>> endptr, int base) throws LastError;
- Author:
- Olivier Chafik
- See Also:
- Serialized Form
Methods inherited from class java.lang.Throwable |
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
getCode
public int getCode()
- Native error code (as returned by errno or GetLastError()).
getDescription
public String getDescription()
- Native error description (as returned by strerror or FormatMessage).
Copyright © 2009-2012. All Rights Reserved.