-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crashes with 0d #278
Comments
This is actually expected behaviour, because you can't roll What behaviour would you expect in this situation? |
Some kind of human readable message like "you can't roll 0 dice" would be better error handling. I'm using rpg-dice-roller in a very simple service for a mastodon dice roller bot (https://codeberg.org/nesges/rollbot-mastodon/src/branch/main/server/server.js) and users try funny things |
It's nice to see someone implementing it on Mastodon! Really cool. You make a good point about the readability. I've been having a think about it and, at the core it's difficult to make those errors really nice, because they're thrown by the grammar parser library, Peggy. And, before it's been parsed, it's not easy to reliably tell if the notation is invalid. However, I've just been looking over the Peggy docs, and it looks like the error messages can be enhanced slightly by naming the grammar rules. Most of the rules currently aren't annotated. PRs are always appreciated. |
Description
dice roller crashes on 0d. roller (CLI) throws a stacktrace:
Dice Roller version
v5.3.2
Bundle type
UMD
Node version
v16.20.0
Browser name and version
No response
The text was updated successfully, but these errors were encountered: