Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/event_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ namespace grpc_labview
_callStatus = grpc::Status(statusCode, errorMessage);
}

//---------------------------------------------------------------------
//---------------------------------------------------------------------
grpc::StatusCode CallData::GetCallStatusCode()
{
return _callStatus.error_code();
}

//---------------------------------------------------------------------
//---------------------------------------------------------------------
void CallData::Finish()
Expand Down
6 changes: 6 additions & 0 deletions src/grpc_interop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,12 @@ LIBRARY_EXPORT int32_t GetRequestData(grpc_labview::gRPCid** id, int8_t* lvReque
data->_call->ReadComplete();
return 0;
}
// Check if a custom error status was set via SetCallStatus
auto statusCode = data->_call->GetCallStatusCode();
if (statusCode != grpc::StatusCode::OK)
{
return -(1000 + statusCode);
}
return -2;
} catch (const std::exception&) {
return grpc_labview::TranslateException();
Expand Down
1 change: 1 addition & 0 deletions src/grpc_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ namespace grpc_labview
void ReadComplete();
void SetCallStatusError(std::string errorMessage);
void SetCallStatusError(grpc::StatusCode statusCode, std::string errorMessage);
grpc::StatusCode GetCallStatusCode();

private:
LabVIEWgRPCServer* _server;
Expand Down
Loading