robotpy-wpilib icon indicating copy to clipboard operation
robotpy-wpilib copied to clipboard

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

Open virtuald opened this issue 10 years ago • 5 comments

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

virtuald avatar Feb 19 '15 04:02 virtuald

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

ArchdukeTim avatar Aug 11 '17 00:08 ArchdukeTim

That only applies to the main thread.

virtuald avatar Aug 11 '17 00:08 virtuald

Ah. I see

ArchdukeTim avatar Aug 11 '17 00:08 ArchdukeTim

import sys
def my_except_hook(exctype, value, traceback):
    # Warn DS here
    sys.__excepthook__(exctype, value, traceback)
sys.excepthook = my_except_hook

ArchdukeTim avatar Aug 11 '17 00:08 ArchdukeTim

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

auscompgeek avatar Aug 11 '17 02:08 auscompgeek