Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3607 Unify exception handling policy of TProcessor
  3. THRIFT-3610

Streamline exception handling in Python server handler

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.11.0
    • Component/s: Python - Compiler
    • Labels:
      None

      Description

      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)

      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(...)
      

        Attachments

          Activity

            People

            • Assignee:
              nsuke Aki Sukegawa
              Reporter:
              nsuke Aki Sukegawa
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: