Skip to content

Commit

Permalink
When an Error is found, return it instead of real value
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed Aug 18, 2024
1 parent 42da3aa commit 2cc7ef5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ private void startSessionImpl() {
} catch (IOException ex) {
logger.log(Level.SEVERE, line, ex);
}
if (InteropLibrary.getUncached().isException(b.getValue())) {
nodeState = new ReplExecutionEventNodeState(b.getValue(), nodeState.getLastScope());
}
}
}
exit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -87,11 +86,8 @@ public void panicOnError() throws Exception {
v
""";
var r = ContextUtils.evalModule(ctx, code, "ScriptTest.enso", "inspect");
assertTrue("Got array back: " + r, r.hasArrayElements());
assertEquals("Got three elements", 3, r.getArraySize());
assertFalse("No error at 0th" + r, r.getArrayElement(0).isException());
assertTrue("Error 2 at 1st" + r, r.getArrayElement(1).isException());
assertTrue("Error 2 at 2nd " + r, r.getArrayElement(2).isException());
assertTrue("Got error back: " + r, r.isException());
assertEquals("(Error: 2)", r.toString());
assertEquals("No output printed", "", out.toString());
assertThat(
"Stderr contains some errors",
Expand Down

0 comments on commit 2cc7ef5

Please sign in to comment.