Inconsistet Context.abort() - valid in aio but not in sync version.
- Dominant language
- C++
- Stars
- 45.3k
- Forks
- 11.4k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 47
Description
### What version of gRPC and what language are you using?
1.41.1
### What operating system (Linux, Windows,...) and version?
Windows 10
### What runtime / compiler are you using (e.g. python version or version of gcc)
Python 3.9
### What did you do?
Please provide either 1) A unit test for reproducing the bug or 2) Specific steps for us to follow to reproduce the bug. If there’s not enough information to debug the problem, gRPC team may close the issue at their discretion. You’re welcome to re-open the issue once you have a reproduction.
I want code sync/async same way (error handling).
Async signature allow to add trailing data what i excepted.
```
@abc.abstractmethod
async def abort(
self,
code: grpc.StatusCode,
details: str = '',
trailing_metadata: Metadata = tuple()) -> None:
```
Sync version can handle it too but signature of abort is different without reason.
No trailing_metadata
```
@abc.abstractmethod
def abort(self, code, details):
"""Raises an exception to terminate the RPC with a non-OK status.
The code and details passed as arguments will supercede any existing
ones.
Args:
code: A StatusCode object to be sent to the client.
It must not be StatusCode.OK.
details: A UTF-8-encodable string to be sent to the client upon
termination of the RPC.
Raises:
Exception: An exception is always raised to signal the abortion the
RPC to the gRPC runtime.
"""
raise NotImplementedError()
```
See:
https://grpc.github.io/grpc/python/_modules/grpc/aio/_base_server.html#ServicerContext.abort
https://grpc.github.io/grpc/python/_modules/grpc.html#ServicerContext.abort
### What did you expect to see?
Same abort in sync and async to code same.
### What did you see instead?
Inconsistence.
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
See [TROUBLESHOOTING.md](https://github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md) for how to diagnose problems better.
### Anything else we should know about your project / environment?
Contributor guide
Assessment
This issue has not been assessed yet.