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

Inconsistent Error Message Output in Sim Control Panel #1631

Closed
Mrockwell2 opened this issue Dec 22, 2023 · 0 comments · Fixed by #1636
Closed

Inconsistent Error Message Output in Sim Control Panel #1631

Mrockwell2 opened this issue Dec 22, 2023 · 0 comments · Fixed by #1636
Assignees

Comments

@Mrockwell2
Copy link
Contributor

The approach the Sim Control Panel takes to display error messages is a little scattered. In some places, there is a JOptionPane popup, while, in others, it prints the message directly to the status message pane. Also, with the latter method, there is a possibility that the error will be printed to standard output. I see no reason why there should be two methods, with a possible third, when we can consolidate it into one. I've included examples of both instances below.

JOptionPane.showMessageDialog(getMainFrame(),
"Sorry, can't connect. Please make sure the availability of both server and port!",
"Connection error", JOptionPane.ERROR_MESSAGE);

JOptionPane.showMessageDialog(getMainFrame(),
"No server connection. Please connect!",
"No server connection", JOptionPane.ERROR_MESSAGE);

try {
doc.insertString(doc.getLength(), "Can't connect! Please provide valid host name and port number separated by : or whitespace!\n", redStyle);
} catch (BadLocationException ble) {
System.out.println("Can't connect! Please provide valid host name and port number separated by : or whitespace!");
}

try {
doc.insertString(doc.getLength(), elements[1] + " is not a valid port number!\n", redStyle);
} catch (BadLocationException ble) {
System.out.println(elements[1] + " is not a valid port number!");
}

@Mrockwell2 Mrockwell2 self-assigned this Dec 22, 2023
@Mrockwell2 Mrockwell2 linked a pull request Jan 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant