thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-3610) Streamline exception handling in Python server handler
Date Wed, 25 Oct 2017 14:28:00 GMT

    [ https://issues.apache.org/jira/browse/THRIFT-3610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16218734#comment-16218734
] 

ASF GitHub Bot commented on THRIFT-3610:
----------------------------------------

Github user jeking3 commented on the issue:

    https://github.com/apache/thrift/pull/842
  
    @nsuke a reminder to rebase and resubmit


> Streamline exception handling in Python server handler
> ------------------------------------------------------
>
>                 Key: THRIFT-3610
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3610
>             Project: Thrift
>          Issue Type: Sub-task
>          Components: Python - Compiler
>            Reporter: Aki Sukegawa
>            Assignee: Aki Sukegawa
>            Priority: Minor
>
> It also serves as a reference implementation of THRIFT-3607.
> Only needed behavior change was to send catched TApplicationException, rather than opaque
TApplicationException(INTERNAL_ERROR).
> It now looks like this (comments are not generated)
> {code}
> try:
>     # handler call
>     ...
> except TTransport.TTransportException:  # disconnect
>     raise
> except Xception as err1:  # declared exception
>     msg_type = TMessageType.REPLY
>     result.err1 = err1
> except TApplicationException as ex:    # send as is
>     logging.exception('TApplication exception in handler')
>     msg_type = TMessageType.EXCEPTION
>     result = ex
> except Exception:  # send INTERNAL_ERROR
>     logging.exception('Unexpected exception in handler')
>     msg_type = TMessageType.EXCEPTION
>     result = TApplicationException(...)
> result.write(...)
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message