Skip to content

Commit

Permalink
API errors now return information via gRPC metadata (not the response) (
Browse files Browse the repository at this point in the history
#692)

* API errors now use custom helper methods ConvertApiErrorStatusFor* to return a message.
* Fixing tests that expected response errors.
* Ensure proper json encoding. Lower string length limit to 2K (instead of 4K as originally designed).
  • Loading branch information
dmondrik authored Aug 11, 2022
1 parent a7a4348 commit 13aca5b
Show file tree
Hide file tree
Showing 102 changed files with 14,416 additions and 8,494 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ add_executable(IntegrationTestsRunner
"${service_output_dir}/nifake_non_ivi/nifake_non_ivi_client.cpp"
"${service_output_dir}/nifake_non_ivi/nifake_non_ivi_service.cpp"
"${custom_dir}/nifake_non_ivi_service.custom.cpp"
"${custom_dir}/nifake_service.custom.cpp"
)

set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
Expand All @@ -370,7 +371,8 @@ target_link_libraries(IntegrationTestsRunner
gmock
${_GRPC_GRPCPP}
${CMAKE_DL_LIBS}
Threads::Threads)
Threads::Threads
nlohmann_json::nlohmann_json)

add_library(TestApi SHARED
"source/tests/utilities/test_api.cpp")
Expand Down
2,227 changes: 1,510 additions & 717 deletions generated/nidaqmx/nidaqmx_service.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions generated/nidaqmx/nidaqmx_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ class NiDAQmxService final : public NiDAQmx::WithCallbackMethod_RegisterSignalEv
private:
NiDAQmxLibraryInterface* library_;
ResourceRepositorySharedPtr session_repository_;
::grpc::Status ConvertApiErrorStatusForTaskHandle(google::protobuf::int32 status, TaskHandle task);

NiDAQmxFeatureToggles feature_toggles_;
};
Expand Down
607 changes: 463 additions & 144 deletions generated/nidcpower/nidcpower_service.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions generated/nidcpower/nidcpower_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class NiDCPowerService final : public NiDCPower::Service {
private:
NiDCPowerLibraryInterface* library_;
ResourceRepositorySharedPtr session_repository_;
::grpc::Status ConvertApiErrorStatusForViSession(google::protobuf::int32 status, ViSession vi);
void Copy(const std::vector<ViBoolean>& input, google::protobuf::RepeatedField<bool>* output);

NiDCPowerFeatureToggles feature_toggles_;
Expand Down
733 changes: 509 additions & 224 deletions generated/nidigitalpattern/nidigitalpattern_service.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions generated/nidigitalpattern/nidigitalpattern_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ class NiDigitalService final : public NiDigital::Service {
private:
NiDigitalLibraryInterface* library_;
ResourceRepositorySharedPtr session_repository_;
::grpc::Status ConvertApiErrorStatusForViSession(google::protobuf::int32 status, ViSession vi);
void Copy(const std::vector<ViBoolean>& input, google::protobuf::RepeatedField<bool>* output);
template <typename TEnum>
void CopyBytesToEnums(const std::string& input, google::protobuf::RepeatedField<TEnum>* output);
Expand Down
Loading

0 comments on commit 13aca5b

Please sign in to comment.