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 Thu, 30 Nov 2017 03:12:00 GMT

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

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

GitHub user jeking3 opened a pull request:

    https://github.com/apache/thrift/pull/1426

    THRIFT-3610 Streamline exception handling in Python server handler

    Client: py
    
    (resubmitting for nsuke)
    
    This closes #842
    This closes #1426

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jeking3/thrift THRIFT-3610-take-2

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/1426.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1426
    
----
commit 93950c84abf8d91db5f2e5c6800fbe78a23f7cb7
Author: Nobuaki Sukegawa <nsuke@apache.org>
Date:   2016-02-10T22:06:21Z

    THRIFT-3610 Streamline exception handling in Python server handler
    Client: py
    
    This closes #842
    This closes #1426

----


> 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