|
@@ -79,6 +79,21 @@ public final class Script {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void logException(Exception ex, String instructionName, int line) {
|
|
|
|
+ if(stackTrace) {
|
|
|
|
+ ex.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ scriptManager.getLogger().print(null, ex, instructionName, name, this,
|
|
|
|
+ new StackTrace(line, returnStack, code));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public int getLine() {
|
|
|
|
+ if(lineIndex < 0 || lineIndex >= code.length) {
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ return code[lineIndex].getLine();
|
|
|
|
+ }
|
|
|
|
+
|
|
public void run() {
|
|
public void run() {
|
|
isWaiting = false;
|
|
isWaiting = false;
|
|
|
|
|
|
@@ -99,11 +114,7 @@ public final class Script {
|
|
|
|
|
|
lineIndex++;
|
|
lineIndex++;
|
|
} catch(Exception ex) {
|
|
} catch(Exception ex) {
|
|
- if(stackTrace) {
|
|
+ logException(ex, instr.getName(), instr.getLine());
|
|
- ex.printStackTrace();
|
|
|
|
- }
|
|
|
|
- scriptManager.getLogger().print(null, ex, instr.getName(), name, this,
|
|
|
|
- new StackTrace(instr.getLine(), returnStack, code));
|
|
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|