Navigation Menu

Skip to content

Commit

Permalink
Support overriding Exception#message
Browse files Browse the repository at this point in the history
  • Loading branch information
ujihisa committed Apr 12, 2018
1 parent bf4b9c7 commit 3e3dae5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/src/main/java/org/jruby/runtime/backtrace/TraceType.java
Expand Up @@ -399,7 +399,12 @@ protected static String printBacktraceJRuby(RubyException exception, boolean con
boolean color = console && runtime.getInstanceConfig().getBacktraceColor();

// exception line
String message = exception.message(context).toString();
String message;
try {
message = exception.callMethod(context, "message").toString();
} catch (org.jruby.exceptions.Exception _) {
message = exception.message(context).toString();
}
if (exception.getMetaClass() == runtime.getRuntimeError() && message.length() == 0) {
message = "No current exception";
}
Expand Down Expand Up @@ -505,4 +510,4 @@ private static void printErrorPos(ThreadContext context, PrintStream errorStream
}
}
}
}
}

0 comments on commit 3e3dae5

Please sign in to comment.