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

Method error

ij/src/main/java/ij/macro/Interpreter.java:1368–1433  ·  view source on GitHub ↗
(String message)

Source from the content-addressed store, hash-verified

1366 }
1367
1368 void error(String message) {
1369 errorMessage = message;
1370 if (ignoreErrors)
1371 return;
1372 errorCount++;
1373 boolean showMessage = !done;
1374 String[] variables = showMessage?getVariables():null;
1375 token = EOF;
1376 tokenString = "";
1377 IJ.showStatus("");
1378 IJ.showProgress(0, 0);
1379 batchMode = false;
1380 imageTable = imageActivations = null;
1381 WindowManager.setTempCurrentImage(null);
1382 wasError = true;
1383 if (!evaluating)
1384 instance = null;
1385 if (showMessage && message!=null) {
1386 String line = getErrorLine();
1387 String originalLine = line;
1388 done = true;
1389 int max = 90;
1390 int len = line.length();
1391 if (len>max) {
1392 StringBuilder sb = new StringBuilder(len+50);
1393 int count = 0;
1394 for (int i=0; i<len; i++){
1395 sb.append(line.charAt(i));
1396 count++;
1397 if (count>=max && i<len-7) {
1398 sb.append("\n ");
1399 count = 0;
1400 }
1401 }
1402 line = sb.toString();
1403 }
1404 Frame f = WindowManager.getFrame("Debug");
1405 TextPanel panel = null;
1406 if (showVariables && f!=null && (f instanceof TextWindow)) { //clear previous content
1407 TextWindow debugWindow = (TextWindow) f;
1408 if (debugWindow != null) {
1409 panel = debugWindow.getTextPanel();
1410 panel.clear();
1411 }
1412 }
1413 String calledFrom = "";
1414 if (callDepth > 0 && callStack != null) {
1415 for (int jj = callDepth - 1; jj >= 0; jj--) {
1416 int theline = callStack[jj];
1417 calledFrom += "\t\t(called from line " + theline +")\n";
1418 }
1419 }
1420 showError("Macro Error", message+" in line "+lineNumber +"\n" + calledFrom +" \n"+line, variables);
1421 f = WindowManager.getFrame("Debug");
1422 if (showVariables && f!=null && (f instanceof TextWindow)) {
1423 TextWindow debugWindow = (TextWindow)f;
1424 debugWindow.append("\n---\t\t---\nError:\t\t" + message + " in line "+lineNumber + ":");
1425 debugWindow.append(calledFrom + "\t\t");

Callers 15

parseArgumentListMethod · 0.95
dispatchMethod · 0.95
runMethod · 0.95
doStatementMethod · 0.95
pushArgsMethod · 0.95
setupArgsMethod · 0.95
doReturnMethod · 0.95
doForMethod · 0.95
doDoMethod · 0.95
doBlockMethod · 0.95
skipStatementMethod · 0.95
skipBlockMethod · 0.95

Calls 14

getVariablesMethod · 0.95
showStatusMethod · 0.95
showProgressMethod · 0.95
setTempCurrentImageMethod · 0.95
getErrorLineMethod · 0.95
getFrameMethod · 0.95
getTextPanelMethod · 0.95
clearMethod · 0.95
showErrorMethod · 0.95
appendMethod · 0.95
charAtMethod · 0.80
lengthMethod · 0.65

Tested by

no test coverage detected