MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / handleException

Method handleException

ij/src/main/java/ij/IJ.java:2604–2628  ·  view source on GitHub ↗

Displays a stack trace. Use the setExceptionHandler method() to override with a custom exception handler.

(Throwable e)

Source from the content-addressed store, hash-verified

2602 /** Displays a stack trace. Use the setExceptionHandler
2603 method() to override with a custom exception handler. */
2604 @AstroImageJ(reason = "Log exceptions to console as well", modified = true)
2605 public static void handleException(Throwable e) {
2606 e.printStackTrace();
2607 if (exceptionHandler!=null) {
2608 exceptionHandler.handle(e);
2609 return;
2610 }
2611 if (Macro.MACRO_CANCELED.equals(e.getMessage()))
2612 return;
2613 CharArrayWriter caw = new CharArrayWriter();
2614 PrintWriter pw = new PrintWriter(caw);
2615 e.printStackTrace(pw);
2616 String s = caw.toString();
2617 String lineNumber = "";
2618 if (s!=null && s.contains("ThreadDeath"))
2619 return;
2620 Interpreter interpreter = Thread.currentThread().getName().endsWith("Macro$") ? Interpreter.getInstance() : null;
2621 if (interpreter!=null)
2622 lineNumber = "\nMacro line number: " + interpreter.getLineNumber();
2623 if (getInstance()!=null) {
2624 s = IJ.getInstance().getInfo()+lineNumber+"\n \n"+s;
2625 new TextWindow("Exception", s, 500, 340);
2626 } else
2627 log(s);
2628 }
2629
2630 /** Installs a custom exception handler that
2631 overrides the handleException() method. */

Callers 15

runMethod · 0.95
runMacroMethod · 0.95
runMacroMethod · 0.95
runMacroMethod · 0.95
runCompiledPluginMethod · 0.95
runMethod · 0.95
save16BitImageMethod · 0.95
openFileMethod · 0.95
showSystemClipboardMethod · 0.95
doFitMethod · 0.95
openMethod · 0.95
printStringMethod · 0.95

Calls 11

getInstanceMethod · 0.95
getLineNumberMethod · 0.95
getInstanceMethod · 0.95
logMethod · 0.95
handleMethod · 0.65
getNameMethod · 0.65
equalsMethod · 0.45
getMessageMethod · 0.45
toStringMethod · 0.45
containsMethod · 0.45
getInfoMethod · 0.45

Tested by

no test coverage detected