From: Jani Mäkinen Date: Wed, 1 Jul 2020 12:19:18 +0000 (+0300) Subject: add variable names to value is nan/inf errors for model debugging X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F32%2F4332%2F1;p=simantics%2Fsysdyn.git add variable names to value is nan/inf errors for model debugging gitlab #66 Change-Id: Ibd94778043c07acef6310554ed8ebbd60caeb6e9 --- diff --git a/bundles/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Assignment.java b/bundles/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Assignment.java index 2a49d408..58cbf532 100644 --- a/bundles/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Assignment.java +++ b/bundles/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Assignment.java @@ -67,11 +67,11 @@ public class Assignment { if(value instanceof Double) { if(Double.isNaN((Double)value)) { System.err.println("value is invalid (NaN): " + var.base.name); - throw new IllegalStateException("value is invalid (NaN)"); + throw new IllegalStateException("value is invalid (NaN): " + var.base.name); } if(Double.isInfinite((Double)value)) { System.err.println("value is invalid (Infinite): " + var.base.name); - throw new IllegalStateException("value is invalid (Infinite)"); + throw new IllegalStateException("value is invalid (Infinite): " + var.base.name); } } if(value instanceof Array) { diff --git a/bundles/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Solver.java b/bundles/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Solver.java index 61e7ec2e..e7925b48 100644 --- a/bundles/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Solver.java +++ b/bundles/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Solver.java @@ -54,11 +54,11 @@ public class Solver { if(value instanceof Double) { if(Double.isNaN((Double)value)) { System.err.println("value is invalid (NaN): " + var.base.name); - throw new IllegalStateException("value is invalid (NaN)"); + throw new IllegalStateException("value is invalid (NaN): " + var.base.name); } if(Double.isInfinite((Double)value)) { System.err.println("value is invalid (Infinite): " + var.base.name); - throw new IllegalStateException("value is invalid (Infinite)"); + throw new IllegalStateException("value is invalid (Infinite): " + var.base.name); } } if(value instanceof Array) {