Skip to content

Commit

Permalink
#3735: show file name and line number
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Dec 23, 2024
1 parent 8386369 commit 8a35389
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions eo-runtime/src/main/java/org/eolang/PhSafe.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ private static <T> T through(final Action<T> action) {
private static String message(final Throwable exp) {
final StringBuilder ret = new StringBuilder(0);
if (!(exp instanceof ExFailure)) {
final StackTraceElement[] stack = exp.getStackTrace();
if (stack.length > 0) {
final StackTraceElement last = stack[0];
ret.append(last.getFileName());
ret.append(':');
ret.append(last.getLineNumber());
ret.append(' ');
}
ret.append(exp.getClass().getSimpleName());
}
if (exp.getMessage() != null) {
Expand Down

0 comments on commit 8a35389

Please sign in to comment.