From d0942f833132415ef5c585c81ebaf146f442901a Mon Sep 17 00:00:00 2001 From: Varun Date: Mon, 3 Jan 2022 21:06:47 -0800 Subject: [PATCH] add breaks to case and catch all exception in case somethings goes wrong --- .../auton/guiauto/serialization/command/SendableCommand.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/frc/auton/guiauto/serialization/command/SendableCommand.java b/src/main/java/frc/auton/guiauto/serialization/command/SendableCommand.java index 9ee51fa0..1c13f4f7 100644 --- a/src/main/java/frc/auton/guiauto/serialization/command/SendableCommand.java +++ b/src/main/java/frc/auton/guiauto/serialization/command/SendableCommand.java @@ -134,12 +134,17 @@ public boolean execute() { switch (methodName) { case "print": System.out.println(objArgs[0]); + break; case "sleep": Thread.sleep((long) objArgs[0]); + break; } } catch (InterruptedException e) { DriverStation.reportError("Thread interrupted while sleeping", e.getStackTrace()); return false; + } catch (Exception e) { + DriverStation.reportError("Could not invoke method " + methodName, e.getStackTrace()); + return false; } } return true;