Open GraysonTinker opened 3 months ago
I agree that it would be nice to show user exceptions as well. Kudos for tracing how the FTC SDK handles those exceptions. If you're interested in pursuing this further, I would open an issue against the SDK repo asking why user exceptions aren't incorporated into the global error message and then dash will automatically get this feature without additional effort.
Currently, unlike global errors, User Code Exceptions aren't displayed in any way on the dashboard. This isn't necessarily bad, as the errors are still visible in logcat, but it can be a bit unintuitive to have an opmode suddenly stop without any indication as to why, especially when it occurs as a result of hardwareMap errors during the init phase.
While investigating the possibility of making a PR for this issue, I looked into how Exception data originating from user code travels. The data that is currently acquired and sent to the dashboard comes from
RobotLog.getGlobalErrorMessage()
, which is set byRobotLog.setGlobalErrorMessage()
. However, User Code Exceptions are handled differently: instead, they are simply logged as an error, and have up to 15 lines sent to the Driver Hub via theNetworkConnectionHandler
. This occurs insideOpModeManagerImpl.handleUserCodeException()
.Here are some potential ways to add this functionality to the Dashboard if this seems like something worth pursuing:
RobotCore
to send the Exception to us, potentially raising questions about whether this is possible to do, desirable in the first place, and/or legal.Thanks for reading :)