From 78e074bb726fd262c6e6e3355b653bebf8cec17a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jani=20M=C3=A4kinen?= Date: Wed, 1 Jul 2020 15:19:18 +0300 Subject: [PATCH] add variable names to value is nan/inf errors for model debugging gitlab #66 Change-Id: Ibd94778043c07acef6310554ed8ebbd60caeb6e9 --- .../src/fi/semantum/sysdyn/solver/Assignment.java | 4 ++-- .../src/fi/semantum/sysdyn/solver/Solver.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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) { -- 2.47.1