Catch panics and other errors in signal handling.