Skip to content
Snippets Groups Projects
Commit 6ccfff7b authored by Christian Humer's avatar Christian Humer
Browse files

Fix error reporting happens internally.

parent 758f6644
Branches
No related tags found
No related merge requests found
......@@ -343,6 +343,16 @@ final class REngine implements Engine {
RContext.threadLocalContext.set(context);
try {
return ((REngine) context.getThisEngine()).runCall(callTarget, context.stateREnvironment.getGlobalFrame(), true, true);
} catch (ReturnException ex) {
return ex.getResult();
} catch (DebugExitException | QuitException | BrowserQuitException e) {
throw e;
} catch (RError e) {
// TODO normal error reporting is done by the runtime
RInternalError.reportError(e);
return null;
} catch (Throwable t) {
return t;
} finally {
RContext.threadLocalContext.set(oldContext);
}
......
......@@ -29,47 +29,27 @@ import com.oracle.truffle.api.TruffleLanguage.Env;
public class DefaultConsoleHandler implements ConsoleHandler {
private final BufferedReader in;
private final OutputStreamWriter out;
private final PrintStream out;
public DefaultConsoleHandler(Env env) {
in = new BufferedReader(new InputStreamReader(env.in()));
out = new OutputStreamWriter(env.out());
out = new PrintStream(env.out());
}
public void println(String s) {
try {
out.append(s).append('\n');
out.flush();
} catch (IOException e) {
throw new RuntimeException(e);
}
out.println(s);
}
public void print(String s) {
try {
out.append(s).append('\n');
out.flush();
} catch (IOException e) {
throw new RuntimeException(e);
}
out.print(s);
}
public void printErrorln(String s) {
try {
out.append(s).append('\n');
out.flush();
} catch (IOException e) {
throw new RuntimeException(e);
}
out.println(s);
}
public void printError(String s) {
try {
out.append(s).append('\n');
out.flush();
} catch (IOException e) {
throw new RuntimeException(e);
}
out.print(s);
}
public String readLine() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment