|
36 | 36 | from ..event import EventType
|
37 | 37 | from ..exceptions import ConnectionClosedException
|
38 | 38 | from ..exceptions import InvalidErrorCodeException
|
39 |
| -from ..exceptions import TChannelException |
40 | 39 | from ..io import BytesIO
|
41 | 40 | from ..messages.common import PROTOCOL_VERSION
|
42 | 41 | from ..messages.common import FlagsType
|
43 | 42 | from ..messages.error import ErrorMessage
|
44 | 43 | from ..messages.types import Types
|
45 |
| -from .message_factory import build_protocol_error |
| 44 | +from .message_factory import build_protocol_exception |
46 | 45 | from .message_factory import MessageFactory
|
47 | 46 |
|
48 | 47 | try:
|
@@ -227,11 +226,11 @@ def _loop(self):
|
227 | 226 | future = self._outstanding.pop(context.message_id)
|
228 | 227 |
|
229 | 228 | if context.message.message_type == Types.ERROR:
|
230 |
| - protocol_error = build_protocol_error( |
| 229 | + protocol_exception = build_protocol_exception( |
231 | 230 | context.message,
|
232 | 231 | context.message_id,
|
233 | 232 | )
|
234 |
| - future.set_exception(protocol_error) |
| 233 | + future.set_exception(protocol_exception) |
235 | 234 | continue
|
236 | 235 |
|
237 | 236 | if response and future.running():
|
@@ -609,15 +608,13 @@ def send_request(self, request):
|
609 | 608 |
|
610 | 609 | def adapt_result(self, f, request, response_future):
|
611 | 610 | if f.exception():
|
612 |
| - protocol_error = f.exception() |
613 |
| - protocol_error.tracing = request.tracing |
614 |
| - response_future.set_exception( |
615 |
| - TChannelException(protocol_error.description) |
616 |
| - ) |
| 611 | + protocol_exception = f.exception() |
| 612 | + protocol_exception.tracing = request.tracing |
| 613 | + response_future.set_exception(protocol_exception) |
617 | 614 | # event: after_receive_protocol_error
|
618 | 615 | self.tchannel.event_emitter.fire(
|
619 |
| - EventType.after_receive_protocol_error, |
620 |
| - protocol_error, |
| 616 | + EventType.after_receive_error, |
| 617 | + protocol_exception, |
621 | 618 | )
|
622 | 619 | else:
|
623 | 620 | response = f.result()
|
|
0 commit comments