robotpy / mostrobotpy

Official Repository of python implementation of WPILib components
https://robotpy.github.io
Other
9 stars 10 forks source link

If threads crash with unhandled exceptions, the driver station should be notified #35

Open virtuald opened 9 years ago

virtuald commented 9 years ago

I suspect there's a python mechanism to do this. The DriverStation error reporting mechanism could be used to do this.

ArchdukeTim commented 6 years ago

Isn't this handled here? https://github.com/robotpy/robotpy-wpilib/blob/master/wpilib/wpilib/robotbase.py#L189

virtuald commented 6 years ago

That only applies to the main thread.

ArchdukeTim commented 6 years ago

Ah. I see

ArchdukeTim commented 6 years ago
import sys
def my_except_hook(exctype, value, traceback):
    # Warn DS here
    sys.__excepthook__(exctype, value, traceback)
sys.excepthook = my_except_hook
auscompgeek commented 6 years ago

Probably best to save the old sys.excepthook in case something else wants an excepthook as well.