]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/SCLValueAccessor.java
Merge "Fixed ProfileObserver.update race with multiple query threads"
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / variable / SCLValueAccessor.java
index 5d4915d94035d204ba0c966dd949ebfc0d55256f..082caa603ba486bf4319f102434d184c5fdedd14 100644 (file)
@@ -5,6 +5,9 @@ import org.simantics.databoard.type.Datatype;
 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;
@@ -35,7 +38,7 @@ public class SCLValueAccessor implements ValueAccessor {
         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);
         }
@@ -48,7 +51,7 @@ public class SCLValueAccessor implements ValueAccessor {
         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);
         }
@@ -61,7 +64,7 @@ public class SCLValueAccessor implements ValueAccessor {
         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);
         }
@@ -74,7 +77,7 @@ public class SCLValueAccessor implements ValueAccessor {
         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);
         }
@@ -87,7 +90,7 @@ public class SCLValueAccessor implements ValueAccessor {
         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);
         }