Skip to content

Commit

Permalink
feat: throw runtime error for dimensional check failures
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayankur31 committed Jun 12, 2024
1 parent 40d8ff1 commit fe74196
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.lemsml.jlems.core.run.EventAction;
import org.lemsml.jlems.core.run.KScheme;
import org.lemsml.jlems.core.run.StateType;
import org.lemsml.jlems.core.run.RuntimeError;
import org.lemsml.jlems.core.sim.ContentError;
import org.lemsml.jlems.core.type.Component;
import org.lemsml.jlems.core.type.ComponentType;
Expand Down Expand Up @@ -525,7 +526,7 @@ public Valued getValued(String select) throws ContentError {



public void checkEquations(HashMap<String, Dimensional> cdimHM) throws ContentError {
public void checkEquations(HashMap<String, Dimensional> cdimHM) throws ContentError, RuntimeError {

HashMap<String, Dimensional> dimHM = new HashMap<String, Dimensional>();

Expand Down Expand Up @@ -559,15 +560,16 @@ public void checkEquations(HashMap<String, Dimensional> cdimHM) throws ContentEr
try {
dimHM.put(dv.getName(), dv.getDimensionality(dimHM));
} catch (ContentError ce) {
E.error("Checking " + dv + " in " + r_type + " " + ce.getMessage());
throw new RuntimeError("Checking " + dv + " in " + r_type + " " + ce.getMessage());

}
}

for (ConditionalDerivedVariable cdv : conditionalDerivedVariables) {
try {
dimHM.put(cdv.getName(), cdv.getDimensionality(dimHM));
} catch (ContentError ce) {
E.error("Checking " + cdv + " in " + r_type + " " + ce.getMessage());
throw new RuntimeError("Checking " + cdv + " in " + r_type + " " + ce.getMessage());
}
}

Expand Down

0 comments on commit fe74196

Please sign in to comment.