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

Switch error only shows last line if caused by other program error #492

Closed
processing-bot opened this issue May 28, 2022 · 2 comments
Closed

Comments

@processing-bot
Copy link
Collaborator

Created by: jwoLondon

Description

The following code displays the error ' on 'switch' has been suppressed, which is perhaps related to this problem without displaying the text of the actual error that caused the problem.

enum Option {
  CAT, DOG;
}

void setup() {
  Option option = Option.CAT;
  String noise;

  switch (option) {
  case CAT:
    noise = "miaow";
    break;
  case DOG:
    noise = "woof";
    break;
  }
  println(noise);
}

The full and correct error message is The local variable noise may not have been initialised. Note that a problem regarding missing 'default' on 'switch' has been suppressed, which is perhaps related to this problem. Without this context, the 'on switch has been suppressed' message will be confusing, especially to newer programmers.

The full message is temporarily displayed in the status line above the console when typing the line that first attempts to use 'noise' (println(noise); above), but not on running the program.

Expected Behavior

I would expect the full message to be displayed in the console on running. Or perhaps more helpfully just the first sentence The local variable noise may not have been initialised. since the switch error is a bit misleading.

Your Environment

  • Processing version: 4 beta 8
  • Operating System and OS version: MacOS 11.6.5 (Bug Sur)
@processing-bot
Copy link
Collaborator Author

Created by: benfry

Thanks for the report; fixed by @dzaima for 4.0 beta 9.

@processing-bot
Copy link
Collaborator Author

Created by: github-actions[bot]

This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant