Skip to content
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

A missing case in a switch causes an obscure error message #1460

Closed
emmebi opened this issue Apr 3, 2020 · 1 comment
Closed

A missing case in a switch causes an obscure error message #1460

emmebi opened this issue Apr 3, 2020 · 1 comment
Assignees
Labels
bug macro changes This issue adds or changes macro functions. Extra work is required (testing, wiki, code editor) tested This issue has been QA tested by someone other than the developer.

Comments

@emmebi
Copy link
Collaborator

emmebi commented Apr 3, 2020

Describe the bug
When a macro encounters an unhandled switch case, it produces an obscure error message which doesn't explain the source of the error

To Reproduce
Steps to reproduce the behavior:

  1. create a new macro
  2. add the following code:
[h: m = 2]
[switch(m):
case 1: x = 2
]
  1. run the macro

The output is something like

"line 1:8: unexpected char: ':' " 

Expected behavior
A proper error message explaining the missing case

Screenshots
None

MapTool Info

  • Version: 1.6.x
  • Install: New

Desktop (please complete the following information):

  • OS: Windows
  • Version 10
emmebi added a commit to emmebi/maptool that referenced this issue Apr 3, 2020
@Phergus Phergus added the bug label Apr 3, 2020
@Phergus
Copy link
Contributor

Phergus commented Apr 6, 2020

Tested switch statement without Default and uncaught case.

[h: m = 2][h: x = -1]
[h, switch(m):
  case 1: x = 2;
  case 3: x = 3;
]
[r: x]

now produces

SWITCH option found no match for "2".
       Statement options (if any): h, switch(m)
       Statement Body : case 1: x = 2; case 3: x = 3;

@Phergus Phergus closed this as completed Apr 6, 2020
@Phergus Phergus added macro changes This issue adds or changes macro functions. Extra work is required (testing, wiki, code editor) tested This issue has been QA tested by someone other than the developer. labels Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug macro changes This issue adds or changes macro functions. Extra work is required (testing, wiki, code editor) tested This issue has been QA tested by someone other than the developer.
Projects
None yet
Development

No branches or pull requests

2 participants