obsidian-dice-roller icon indicating copy to clipboard operation
obsidian-dice-roller copied to clipboard

Dice Roller stops working after it encountered a parsing error in a formula

Open vonloxley opened this issue 11 months ago • 0 comments

Check for existing bug reports before submitting.

  • [X] I searched for existing Bug Reports and found no similar reports.

Expected Behavior

I made an error in a formula, like forgetting to put the last needed term into a formula. Ex.: 2d10<. I’d like Dice Roller to either notify me about my error or do nothing until I corrected the error.

Current behaviour

Dice Roller stops working entirely and needs to be disabled and enabled again. Th econsole shows:

Error: invalid syntax at line 1 col 5:

  2d10<
      ^
    at y._token (VM228 plugin:obsidian-dice-roller:16:319)
    at y.next (VM228 plugin:obsidian-dice-roller:15:1538)
    at _.next (VM228 plugin:obsidian-dice-roller:16:572)
    at Function.from (<anonymous>)
    at na.parse (VM228 plugin:obsidian-dice-roller:3528:245783)
    at n0.parse (VM228 plugin:obsidian-dice-roller:3536:6345)
    at n0.getRollerSync (VM228 plugin:obsidian-dice-roller:3536:5153)
    at enter (VM228 plugin:obsidian-dice-roller:3528:247393)
    at e.iterate (app.js:1:553855)
    at ju.iterate (app.js:1:2037967)

Reproduction

  1. Start writing a dice-mod block: but don’t finish it: `dice-mod: 2d10<.
  2. Close the block: `.

Which Operating Systems are you using?

  • [ ] Android
  • [ ] iPhone/iPad
  • [X] Linux
  • [ ] macOS
  • [ ] Windows

Obsidian Version Check

1.5.8 and 1.5.3

Plugin Version

10.4.5

Confirmation

  • [X] I have disabled all other plugins and the issue still persists.

Possible solution

Catch the invalid syntax error. Optionally notify the user.

vonloxley avatar Mar 02 '24 09:03 vonloxley