X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Fvariable%2FSCLValueAccessor.java;h=082caa603ba486bf4319f102434d184c5fdedd14;hb=15af8a20abe8b2ba24b52c9da8bce6c92351dc43;hp=5d4915d94035d204ba0c966dd949ebfc0d55256f;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/SCLValueAccessor.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/SCLValueAccessor.java index 5d4915d94..082caa603 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/SCLValueAccessor.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/SCLValueAccessor.java @@ -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); }