mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-11-27 04:25:19 +01:00
Improve exception message for the Eval class
This commit is contained in:
parent
c33987162e
commit
d25514743f
@ -32,7 +32,7 @@ public class Eval {
|
||||
|
||||
double x = parseExpression();
|
||||
if (pos < toParse.length()) {
|
||||
throw new RuntimeException(warningMessage + "Unexpected: " + (char) ch);
|
||||
throw new RuntimeException(warningMessage + "Unexpected: '" + (char) ch + "' at position " + pos + " in '" + this.toParse + "'");
|
||||
}
|
||||
|
||||
return x;
|
||||
|
@ -11,6 +11,6 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
public static double eval(String toParse, String warningMessage) {
|
||||
return cache.computeIfAbsent(toParse, t -> new Eval(toParse, "[" + warningMessage + "]").parse());
|
||||
return cache.computeIfAbsent(toParse, t -> new Eval(toParse, warningMessage).parse());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user