summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/scripting
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2012-07-12 14:52:36 +0200
committerAndrew Branson <andrew.branson@cern.ch>2012-07-12 14:52:36 +0200
commit20c81748688547c1b13686f15c65fbb1d60d81a0 (patch)
tree59dc2b94c47ed30b8bc93c07cab42e96904d1146 /src/main/java/com/c2kernel/scripting
parent61559eef9369dbdbb027bec7c571d7f770b2e7a3 (diff)
Suspend transition now can carry an optional 'Errors' outcome where
client processes can record the reason for the suspension. Errors XML is marshalled ErrorInfo. UserCodeProcess automatically sends fatal ErrorInfos through suspend jobs. Job API added to to support all this. fixes #23
Diffstat (limited to 'src/main/java/com/c2kernel/scripting')
-rw-r--r--src/main/java/com/c2kernel/scripting/ErrorInfo.java11
-rw-r--r--src/main/java/com/c2kernel/scripting/ScriptErrorException.java30
2 files changed, 40 insertions, 1 deletions
diff --git a/src/main/java/com/c2kernel/scripting/ErrorInfo.java b/src/main/java/com/c2kernel/scripting/ErrorInfo.java
index 26c0384..efe90ce 100644
--- a/src/main/java/com/c2kernel/scripting/ErrorInfo.java
+++ b/src/main/java/com/c2kernel/scripting/ErrorInfo.java
@@ -28,13 +28,22 @@ public class ErrorInfo {
msg.add(error);
}
- public String getErrors() {
+ @Override
+ public String toString() {
StringBuffer err = new StringBuffer();
for (String element : msg) {
err.append(element+"\n");
}
return err.toString();
}
+
+ public void setErrors(ArrayList<String> msg) {
+ this.msg = msg;
+ }
+
+ public ArrayList<String> getErrors() {
+ return msg;
+ }
public void setFatal() {
fatal=true;
diff --git a/src/main/java/com/c2kernel/scripting/ScriptErrorException.java b/src/main/java/com/c2kernel/scripting/ScriptErrorException.java
new file mode 100644
index 0000000..9b1084f
--- /dev/null
+++ b/src/main/java/com/c2kernel/scripting/ScriptErrorException.java
@@ -0,0 +1,30 @@
+package com.c2kernel.scripting;
+
+public class ScriptErrorException extends java.lang.Exception {
+
+ /**
+ * Creates new <code>sciptingEngineException</code> without detail message.
+ */
+ ErrorInfo errors;
+ public ScriptErrorException() {
+ }
+
+ /**
+ * Constructs an <code>sciptingEngineException</code> with the specified detail message.
+ * @param msg the detail message.
+ */
+ public ScriptErrorException(String msg) {
+ super(msg);
+ }
+
+ public ScriptErrorException(ErrorInfo errors) {
+ super(errors.toString());
+ this.errors = errors;
+ }
+
+ public ErrorInfo getErrors() {
+ return errors;
+ }
+}
+
+