import org.simantics.db.ReadGraph;
import org.simantics.db.WriteGraph;
import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.exception.DatatypeNotFoundException;
+import org.simantics.db.layer0.exception.MissingVariableValueException;
+import org.simantics.db.layer0.exception.NonWritableVariableException;
import org.simantics.scl.runtime.SCLContext;
import org.simantics.scl.runtime.function.Function1;
import org.simantics.scl.runtime.function.Function2;
try {
return getValue1.apply(context);
} catch (Throwable t) {
- throw new DatabaseException(t);
+ throw new MissingVariableValueException("Could not get value for " + String.valueOf(context.getRepresents(graph)), t);
} finally {
sclContext.put("graph", oldGraph);
}
try {
return getValue2.apply(context, binding);
} catch (Throwable t) {
- throw new DatabaseException(t);
+ throw new MissingVariableValueException("Could not get value for " + String.valueOf(context.getRepresents(graph)) + " with binding " + binding, t);
} finally {
sclContext.put("graph", oldGraph);
}
try {
setValue2.apply(context, value);
} catch (Throwable t) {
- throw new DatabaseException(t);
+ throw new NonWritableVariableException("Could not write value " + String.valueOf(value) + " for " + String.valueOf(context.getRepresents(graph)), t);
} finally {
sclContext.put("graph", oldGraph);
}
try {
setValue3.apply(context, value, binding);
} catch (Throwable t) {
- throw new DatabaseException(t);
+ throw new NonWritableVariableException("Could not write value " + String.valueOf(value) + " for " + String.valueOf(context.getRepresents(graph)) + " with binding " + binding, t);
} finally {
sclContext.put("graph", oldGraph);
}
try {
return getDatatype.apply(context);
} catch (Throwable t) {
- throw new DatabaseException(t);
+ throw new DatatypeNotFoundException("Could not find datatype for " + String.valueOf(context.getRepresents(graph)), t);
} finally {
sclContext.put("graph", oldGraph);
}