rudimentary user input error handling
This commit is contained in:
parent
24691be12c
commit
8572b88b14
@ -29,7 +29,12 @@ public class LoopingConsole {
|
|||||||
while (true) {
|
while (true) {
|
||||||
System.out.print("> ");
|
System.out.print("> ");
|
||||||
String input = br.readLine();
|
String input = br.readLine();
|
||||||
|
try {
|
||||||
robotEngine.commandBot(createCommand(input));
|
robotEngine.commandBot(createCommand(input));
|
||||||
|
}catch (InvalidUserInputException e) {
|
||||||
|
System.out.println("\nInput error occurred! Message: " + e.getMessage() +"\n");
|
||||||
|
printUsageBanner();
|
||||||
|
}
|
||||||
|
|
||||||
if (input.trim().toLowerCase().equals(EXIT_COMMAND)) {
|
if (input.trim().toLowerCase().equals(EXIT_COMMAND)) {
|
||||||
System.out.println("exiting");
|
System.out.println("exiting");
|
||||||
|
Loading…
Reference in New Issue
Block a user