Skip to content

Commit

Permalink
fix(crash): on more than 2 fractional chance digits
Browse files Browse the repository at this point in the history
  • Loading branch information
iGoodie committed Sep 13, 2020
1 parent 1480b43 commit d35f412
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ private void parseActions(List<String> words) throws TSLSyntaxError {
} catch (IllegalStateException e) {
throw new TSLSyntaxError("Cannot add the action with %1$s%% probability, which goes above 100%%. " +
"(%1$.02f%% + %2$s%% > 100%%)", actions.getTotalPercentage() / 100f, percentage);

} catch (IllegalArgumentException e) {
throw new TSLSyntaxError("Probability expressions accept up to 2 fractional digits." +
" %s cannot be parsed.", percentage);
}

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ public static TSLAction parseAction(String actionName, List<String> actionParame
if (e.getCause() instanceof TSLSyntaxError)
throw (TSLSyntaxError) e.getCause();
e.getCause().printStackTrace();
throw new InternalError("Constructor threw unexpected Throwable: ", e.getCause());
throw new InternalError("Constructor threw unexpected Throwable: " + e.getClass().getSimpleName()
, e.getCause());

} catch (ClassCastException e) {
throw new InternalError("Cannot cast " + actionClass.getSimpleName() + " to " + TSLAction.class.getSimpleName());
Expand Down

0 comments on commit d35f412

Please sign in to comment.