コード例 #1
0
ファイル: remote_test.py プロジェクト: scv119/python-protorpc
 def testApplicationErrorState(self):
   status = remote.RpcStatus(state=remote.RpcState.APPLICATION_ERROR,
                             error_message='an application error',
                             error_name='blam')
   try:
     remote.check_rpc_status(status)
     self.fail('Should have raised application error.')
   except remote.ApplicationError, err:
     self.assertEquals('an application error', str(err))
     self.assertEquals('blam', err.error_name)
コード例 #2
0
ファイル: remote_test.py プロジェクト: Zoramite/protorpc
 def testApplicationErrorState(self):
   status = remote.RpcStatus(state=remote.RpcState.APPLICATION_ERROR,
                             error_message='an application error',
                             error_name='blam')
   try:
     remote.check_rpc_status(status)
     self.fail('Should have raised application error.')
   except remote.ApplicationError as err:
     self.assertEquals('an application error', str(err))
     self.assertEquals('blam', err.error_name)
コード例 #3
0
ファイル: transport.py プロジェクト: bsd/AppEngine-Toolkit
 def __http_error_to_exception(self, http_error):
   error_code = http_error.code
   content_type = http_error.hdrs.get('content-type')
   if content_type == self.protocol.CONTENT_TYPE:
     try:
       rpc_status = self.protocol.decode_message(remote.RpcStatus,
                                                 http_error.read())
     except Exception, decode_err:
       logging.warning(
         'An error occurred trying to parse status: %s\n%s',
         str(decode_err), http_error.msg)
     else:
       # TODO: Move the check_rpc_status to the Rpc.response property.
       # Will raise exception if rpc_status is in an error state.
       remote.check_rpc_status(rpc_status)
コード例 #4
0
ファイル: remote_test.py プロジェクト: scv119/python-protorpc
 def testNoError(self):
   for state in (remote.RpcState.OK, remote.RpcState.RUNNING):
     remote.check_rpc_status(remote.RpcStatus(state=state))
コード例 #5
0
ファイル: remote_test.py プロジェクト: Zoramite/protorpc
 def testNoError(self):
   for state in (remote.RpcState.OK, remote.RpcState.RUNNING):
     remote.check_rpc_status(remote.RpcStatus(state=state))