Skip to content

Commit

Permalink
Java style stack trace
Browse files Browse the repository at this point in the history
  • Loading branch information
aziemchawdhary-gs committed Nov 12, 2024
1 parent 1daa9de commit 1a82dda
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ public <T extends Appendable> T printPureStackTrace(T appendable, String indent,
if ((this.callStack != null) && this.callStack.notEmpty())
{
SafeAppendable safeAppendable = SafeAppendable.wrap(appendable);
safeAppendable.append('\n').append(indent).append("Full Stack:");
this.callStack.toList().reverseForEach(x ->
safeAppendable.append('\n').append(indent).append("Full Stacktrace:");
this.callStack.toList().forEach(x ->
{
safeAppendable.append('\n').append(indent).append(" ");
safeAppendable.append('\n').append(indent).append(" at ");
CoreInstance func = x.getValueForMetaPropertyToOne(M3Properties.func);
if (func != null)
{
Expand All @@ -143,7 +143,8 @@ public <T extends Appendable> T printPureStackTrace(T appendable, String indent,
{
safeAppendable.append("NULL / TODO");
}
writeSourceInformationMessage(safeAppendable.append(" <- "), x.getSourceInformation(), false);
writeSourceInformationMessage(safeAppendable.append(" ("), x.getSourceInformation(), false);
safeAppendable.append(")");
});
}
return appendable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,11 @@ public void testCallStackInExecutionExceptionPure()
PureExecutionException e = Assert.assertThrows(PureExecutionException.class, () -> execute("go():Boolean[1]"));
String trace = e.printPureStackTrace(new StringBuilder(), " ", functionExecution.getProcessorSupport()).toString();
Assert.assertEquals(
" 1: resource:/platform/pure/essential/tests/assert.pure line:26 column:5\n" +
"\n" +
" Full Stack:\n" +
" nest():Boolean[1] <- resource:fromString.pure line:4 column:8\n" +
" fail():Boolean[1] <- resource:fromString.pure line:7 column:31\n" +
" assert(Boolean[1]):Boolean[1] <- resource:/platform/pure/essential/tests/fail.pure line:19 column:5\n" +
" assert(Boolean[1], String[1]):Boolean[1] <- resource:/platform/pure/essential/tests/assert.pure line:31 column:5\n" +
" assert(Boolean[1], Function<{->String[1]}>[1]):Boolean[1] <- resource:/platform/pure/essential/tests/assert.pure line:26 column:5", trace);
"Full Stack[trace:\n" +
" at assert(Boolean[1], Function<{->String[1]}>[1]):Boolean[1] (resource:/platform/pure/essential/tests/assert.pure line:26 column:5)\n" +
" at assert(Boolean[1], String[1]):Boolean[1] (resource:/platform/pure/essential/tests/assert.pure line:31 column:5)\n" +
" at assert(Boolean[1]):Boolean[1] (resource:/platform/pure/essential/tests/fail.pure line:19 column:5)\n" +
" at fail():Boolean[1] (resource:fromString.pure line:7 column:31)\n" +
" at nest():Boolean[1] (resource:fromString.pure line:4 column:8)]>", trace);
}
}

0 comments on commit 1a82dda

Please sign in to comment.