1 # Copyright 2019 gRPC authors.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 """Exceptions for the aio version of the RPC calls."""
17 cdef class AioRpcStatus(Exception):
19 # The final status of gRPC is represented by three trailing metadata:
20 # `grpc-status`, `grpc-status-message`, abd `grpc-status-details`.
22 grpc_status_code code,
24 tuple trailing_metadata,
25 str debug_error_string):
27 self._details = details
28 self._trailing_metadata = trailing_metadata
29 self._debug_error_string = debug_error_string
31 cpdef grpc_status_code code(self):
34 cpdef str details(self):
37 cpdef tuple trailing_metadata(self):
38 return self._trailing_metadata
40 cpdef str debug_error_string(self):
41 return self._debug_error_string
43 cdef grpc_status_code c_code(self):
44 return <grpc_status_code>self._code