Skip to content
Snippets Groups Projects
Commit 87e8a4df authored by Lukas Stadler's avatar Lukas Stadler
Browse files

call error handlers through .handleSimpleError

parent c9186568
Branches
No related tags found
No related merge requests found
......@@ -130,6 +130,7 @@ public class RErrorHandling {
* {@code .signalSimpleWarning} in "conditions.R".
*/
private RFunction dotSignalSimpleWarning;
private RFunction dotHandleSimpleError;
/**
* Initialize and return the value of {@link #dotSignalSimpleWarning}. This is lazy because
......@@ -146,6 +147,16 @@ public class RErrorHandling {
return dotSignalSimpleWarning;
}
private RFunction getDotHandleSimpleError() {
if (dotHandleSimpleError == null) {
CompilerDirectives.transferToInterpreter();
String name = ".handleSimpleError";
Object f = REnvironment.baseEnv().findFunction(name);
dotHandleSimpleError = (RFunction) RContext.getRRuntimeASTAccess().forcePromise(name, f);
}
return dotHandleSimpleError;
}
public static ContextStateImpl newContextState() {
return new ContextStateImpl();
}
......@@ -389,7 +400,9 @@ public class RErrorHandling {
} else {
RFunction handler = (RFunction) entry.getDataAt(2);
RStringVector errorMsgVec = RDataFactory.createStringVectorFromScalar(fMsg);
RContext.getRRuntimeASTAccess().callback(handler, new Object[]{errorMsgVec});
RFunction f = errorHandlingState.getDotHandleSimpleError();
assert f != null;
RContext.getRRuntimeASTAccess().callback(f, new Object[]{handler, errorMsgVec, call});
}
} else {
throw gotoExitingHandler(RNull.instance, call, entry);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment