-
Notifications
You must be signed in to change notification settings - Fork 55
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
Error handling #31
Comments
You can use |
template<typename T, typename R>
class GrpcContext_Ping_Stream : public TGrpcContext<T, R>
{
typedef TGrpcContext<T, R> Super;
protected:
void OnRpcEventInternal(bool Ok, const void* EventTag, typename Super::FRpcCallbackFunc RpcCallbackFunc)
{
if (!Ok)
{
Super::RpcReaderWriter->Finish(&(Super::RpcStatus), Super::ReadTag);
Super::UpdateState(EGrpcContextState::Done);
return;
} As a test I deleted the authorization token from my service, in case of error it seems to go through here (TurboLinkGrpcContext.h), but the callback is not called and for some reason Super::RpcStatus turns out to be ok The rpc method is: |
Sorry, I'm very busy with work recently and don't have time to take care of this project. I will take a look at this issue when I have time. |
I think I realized how it should work in Turbolink context)
also we need to implement another tag for filtering the Finish call
also, in case if we sure that receiving wrong status only possible after AsyncNext isn't Ok then could omit further else branch ```if (Super::RpcStatus.ok())`` slightly modified GrpcContext_Ping_Stream example:
thanks again for the plugin - it's a lifesaver! |
Yes, it seems works, but you miss the part of the tag handling //async tag
void* InitialTag = nullptr;
void* WriteTag = nullptr;
void* ReadTag = nullptr;
void* FinishTag = nullptr; void GrpcContext::UpdateState(EGrpcContextState NewState)
{
if (GetState() == NewState) return;
ContextState = NewState;
if (ContextState == EGrpcContextState::Initialing)
{
InitialTag = Service->TurboLinkManager->GetNextTag(AsShared());
WriteTag = Service->TurboLinkManager->GetNextTag(AsShared());
ReadTag = Service->TurboLinkManager->GetNextTag(AsShared());
FinishTag = Service->TurboLinkManager->GetNextTag(AsShared());
}
else if (ContextState == EGrpcContextState::Done)
{
Service->TurboLinkManager->RemoveTag(InitialTag);
Service->TurboLinkManager->RemoveTag(WriteTag);
Service->TurboLinkManager->RemoveTag(ReadTag);
Service->TurboLinkManager->RemoveTag(FinishTag);
}
if (Client->OnContextStateChange.IsBound())
{
Client->OnContextStateChange.Broadcast(Handle, NewState);
}
} |
yeap, you are right, I forget to note this. mostly to emphasize the async behavior. also in this case, need to add logic above to another context behaviors |
@thejinchao is it possible to integrate the changes proposed by 6r0m? |
I was beating my head against a wall trying to figure out what I was doing wrong, only to spend hours going down this rabbit hole. I don't know C++ GRPC very well, but this does seem like the best solution. Is someone working on a PR? That's probably the easiest way to get this fixed. I have another couple of bugs to report too, but those have (sort of) easy workaround. This doesn't. |
If an error happens the plugin doesn't provide any event
The text was updated successfully, but these errors were encountered: