]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fix to handling of value access error reporting in synchronization. 49/2849/2
authorReino Ruusu <reino.ruusu@semantum.fi>
Thu, 11 Apr 2019 13:56:15 +0000 (16:56 +0300)
committerReino Ruusu <reino.ruusu@semantum.fi>
Thu, 11 Apr 2019 14:01:43 +0000 (14:01 +0000)
gitlab #286

Change-Id: I025541c35a9cf9667eaaf845b68451d1da3af6f3

bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/Synchronizer.java

index 2552192ef75dfa1f45d215c99855b87e91555a7d..cfd5fe69b4ec3eac4129c38a0c526e1b5e8a6441 100644 (file)
@@ -118,22 +118,26 @@ public class Synchronizer {
                }
                return result;
        } catch (MissingVariableValueException e) {
-           handler.reportProblem("Failed to read " + name + ". " + e.getMessage());
+           handler.reportProblem("Failed to read " + name + ": " + e.getMessage());
            
            Throwable cur = e;
            while((cur = cur.getCause()) != null) {
                if(!(cur instanceof MissingVariableValueException)) {
-                   handler.reportProblem(cur.getMessage());
+                   handler.reportProblem("  " + getSafeDescription(cur));
                }
            }
        } catch (Exception e) {
-               handler.reportProblem("Failed to serialize " + name + ": " + e.getMessage(), e);
+               handler.reportProblem("Failed to serialize " + name + ": " + getSafeDescription(e), e);
        }
        
        return null;
        
     }
 
+    private String getSafeDescription(Throwable cur) {
+        return cur.getClass().getName() + (cur == null || cur.getMessage() != null ? ": " + cur.getMessage() : "");
+    }
+
     Collection<SerializedVariable> mapProperties(SynchronizationEventHandler handler, Variable child) throws DatabaseException {
         ArrayList<SerializedVariable> result = new ArrayList<SerializedVariable>();
         for(Variable prop : child.getProperties(graph, StructuralResource2.URIs.SynchronizedRelation)) {