Skip to content

Commit

Permalink
Merge pull request #122 from LEMS/feat/fail-on-dimensional-errors
Browse files Browse the repository at this point in the history
feat: throw runtime error for dimensional check failures
  • Loading branch information
pgleeson committed Jun 13, 2024
2 parents 68afcff + 1c54c44 commit 7acefc0
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,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{

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

Expand Down Expand Up @@ -559,15 +559,18 @@ 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());
String errmsg = ("Checking " + dv + " in " + r_type + " " + ce.getMessage());
throw new ContentError(errmsg);

}
}

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

Expand Down

0 comments on commit 7acefc0

Please sign in to comment.