use of org.graalvm.polyglot.nativeapi.PolyglotNativeAPITypes.PolyglotExtendedErrorInfo in project graal by oracle.
the class PolyglotNativeAPI method handleThrowable.
private static PolyglotStatus handleThrowable(Throwable t) {
PolyglotStatus errorCode = t instanceof PolyglotNativeAPIError ? ((PolyglotNativeAPIError) t).getCode() : polyglot_generic_failure;
String message = t.getMessage();
PolyglotExtendedErrorInfo unmanagedErrorInfo = UnmanagedMemory.malloc(SizeOf.get(PolyglotExtendedErrorInfo.class));
unmanagedErrorInfo.setErrorCode(errorCode.getCValue());
CCharPointerHolder holder = CTypeConversion.toCString(message);
CCharPointer value = holder.get();
unmanagedErrorInfo.setErrorMessage(value);
errorInfo.set(new ErrorInfoHolder(unmanagedErrorInfo, holder));
return errorCode;
}
Aggregations