better handling exceptions with gevent