Skip to content
Browse files

exception handling: restore original state when returning to caller

  • Loading branch information...
1 parent 37a064a commit 73dc3775f8503f55497c6d6d53f8ed9ca2e5207f @mjrusso committed Jan 13, 2011
Showing with 4 additions and 3 deletions.
  1. +4 −3 pyhbase/async.py
View
7 pyhbase/async.py
@@ -19,21 +19,22 @@
try:
from tornado import httpclient
- from tornado.stack_context import ExceptionStackContext
+ from tornado import stack_context
except ImportError:
# async operations not supported unless Tornado is installed
httpclient = None
- ExceptionStackContext = None
+ stack_context = None
class TornadoRequestor(ipc.Requestor):
# TODO: Avro 1.4+: extend `ipc.BaseRequestor` instead of `ipc.Requestor`
def request(self, message_name, request_datum, callback):
+ callback = stack_context.wrap(callback)
exception_handler = partial(self._handle_exception, message_name,
request_datum, callback)
- with ExceptionStackContext(exception_handler):
+ with stack_context.ExceptionStackContext(exception_handler):
return self._request(message_name, request_datum, callback)
def _request(self, message_name, request_datum, callback):

0 comments on commit 73dc377

Please sign in to comment.
Something went wrong with that request. Please try again.