-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add service/method name to RpcError #197
Add service/method name to RpcError #197
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for looking into all cases! I only have two nits.
clientStreaming<I extends object, O extends object>(method?: MethodInfo<I, O>/*, options: RpcOptions*/): ClientStreamingCall<I, O> { | ||
const e = new RpcError('Client streaming is not supported by grpc-web', GrpcStatusCode[GrpcStatusCode.UNIMPLEMENTED]); | ||
if (method) { | ||
e.methodName = method.name; | ||
e.serviceName = method.service.typeName; | ||
} | ||
throw e; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are safe to make the argument required. interface RpcTransport
requires both arguments - I think I just commented them out because my IDE complained about them being unused.
clientStreaming<I extends object, O extends object>(method?: MethodInfo<I, O>/*, options: RpcOptions*/): ClientStreamingCall<I, O> { | |
const e = new RpcError('Client streaming is not supported by grpc-web', GrpcStatusCode[GrpcStatusCode.UNIMPLEMENTED]); | |
if (method) { | |
e.methodName = method.name; | |
e.serviceName = method.service.typeName; | |
} | |
throw e; | |
clientStreaming<I extends object, O extends object>(method: MethodInfo<I, O>/*, options: RpcOptions*/): ClientStreamingCall<I, O> { | |
const e = new RpcError('Client streaming is not supported by grpc-web', GrpcStatusCode[GrpcStatusCode.UNIMPLEMENTED]); | |
e.methodName = method.name; | |
e.serviceName = method.service.typeName; | |
throw e; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made this optional so that the previous unit tests would pass (it didn't pass in the MethodInfo
). Making this optional was a smaller change, but I will make this required and update the unit test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was unaware. Thanks for the update!
duplex<I extends object, O extends object>(method?: MethodInfo<I, O>/*, options: RpcOptions*/): DuplexStreamingCall<I, O> { | ||
const e = new RpcError('Duplex streaming is not supported by grpc-web', GrpcStatusCode[GrpcStatusCode.UNIMPLEMENTED]); | ||
if (method) { | ||
e.methodName = method.name; | ||
e.serviceName = method.service.typeName; | ||
} | ||
throw e; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here - safe to require the argument.
duplex<I extends object, O extends object>(method?: MethodInfo<I, O>/*, options: RpcOptions*/): DuplexStreamingCall<I, O> { | |
const e = new RpcError('Duplex streaming is not supported by grpc-web', GrpcStatusCode[GrpcStatusCode.UNIMPLEMENTED]); | |
if (method) { | |
e.methodName = method.name; | |
e.serviceName = method.service.typeName; | |
} | |
throw e; | |
duplex<I extends object, O extends object>(method: MethodInfo<I, O>/*, options: RpcOptions*/): DuplexStreamingCall<I, O> { | |
const e = new RpcError('Duplex streaming is not supported by grpc-web', GrpcStatusCode[GrpcStatusCode.UNIMPLEMENTED]); | |
e.methodName = method.name; | |
e.serviceName = method.service.typeName; | |
throw e; |
Fixes #195