2010-02-27 06:48:33 +01:00
|
|
|
package com.metaweb.gridworks.expr;
|
|
|
|
|
2010-03-01 01:21:13 +01:00
|
|
|
import java.io.Serializable;
|
2010-02-27 06:48:33 +01:00
|
|
|
import java.util.Properties;
|
|
|
|
|
|
|
|
import org.json.JSONException;
|
|
|
|
import org.json.JSONWriter;
|
|
|
|
|
|
|
|
import com.metaweb.gridworks.Jsonizable;
|
|
|
|
|
2010-03-22 01:54:56 +01:00
|
|
|
/**
|
|
|
|
* An error that occurs during the evaluation of an Evaluable. Errors are values, too
|
|
|
|
* because they can be stored in cells just like strings, numbers, etc. Errors are not
|
|
|
|
* thrown because an error might occupy just one element in an array and doesn't need
|
|
|
|
* to make the whole array erroneous.
|
|
|
|
*/
|
2010-03-01 01:21:13 +01:00
|
|
|
public class EvalError implements Serializable, Jsonizable {
|
|
|
|
private static final long serialVersionUID = -102681220092874080L;
|
|
|
|
|
2010-02-27 06:48:33 +01:00
|
|
|
final public String message;
|
|
|
|
|
|
|
|
public EvalError(String message) {
|
|
|
|
this.message = message;
|
|
|
|
}
|
|
|
|
|
2010-02-28 01:55:09 +01:00
|
|
|
public String toString() {
|
|
|
|
return this.message;
|
|
|
|
}
|
|
|
|
|
2010-02-27 06:48:33 +01:00
|
|
|
public void write(JSONWriter writer, Properties options)
|
|
|
|
throws JSONException {
|
|
|
|
|
|
|
|
writer.object();
|
|
|
|
writer.key("type"); writer.value("error");
|
|
|
|
writer.key("message"); writer.value(message);
|
|
|
|
writer.endObject();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|