Skip to content

Commit

Permalink
Updates behavior when new session name is in use in different resourc…
Browse files Browse the repository at this point in the history
…e repository. (#687)

* Update code to fail unit test.

* Throw exception instead of returning warning status.

* Updated test passes.

* Update codegen to catch SessionException in init methods

* Simplify error message for already used session name.
  • Loading branch information
reckenro committed Jul 29, 2022
1 parent 997b52c commit 07f685d
Show file tree
Hide file tree
Showing 24 changed files with 205 additions and 13 deletions.
12 changes: 12 additions & 0 deletions generated/nidaqmx/nidaqmx_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6709,6 +6709,9 @@ namespace nidaqmx_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -6761,6 +6764,9 @@ namespace nidaqmx_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -6793,6 +6799,9 @@ namespace nidaqmx_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -12146,6 +12155,9 @@ namespace nidaqmx_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions generated/nidcpower/nidcpower_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,9 @@ namespace nidcpower_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -2880,6 +2883,9 @@ namespace nidcpower_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions generated/nidigitalpattern/nidigitalpattern_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2478,6 +2478,9 @@ namespace nidigitalpattern_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -2515,6 +2518,9 @@ namespace nidigitalpattern_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions generated/nidmm/nidmm_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2005,6 +2005,9 @@ namespace nidmm_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -2042,6 +2045,9 @@ namespace nidmm_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down
9 changes: 9 additions & 0 deletions generated/nifake/nifake_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,9 @@ namespace nifake_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -1296,6 +1299,9 @@ namespace nifake_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -1346,6 +1352,9 @@ namespace nifake_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down
21 changes: 21 additions & 0 deletions generated/nifake_non_ivi/nifake_non_ivi_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ namespace nifake_non_ivi_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -362,6 +365,9 @@ namespace nifake_non_ivi_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -393,6 +399,9 @@ namespace nifake_non_ivi_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -430,6 +439,9 @@ namespace nifake_non_ivi_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -459,6 +471,9 @@ namespace nifake_non_ivi_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -489,6 +504,9 @@ namespace nifake_non_ivi_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -519,6 +537,9 @@ namespace nifake_non_ivi_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down
9 changes: 9 additions & 0 deletions generated/nifgen/nifgen_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2447,6 +2447,9 @@ namespace nifgen_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -2484,6 +2487,9 @@ namespace nifgen_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -2521,6 +2527,9 @@ namespace nifgen_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions generated/nirfmxbluetooth/nirfmxbluetooth_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2417,6 +2417,9 @@ namespace nirfmxbluetooth_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -2452,6 +2455,9 @@ namespace nirfmxbluetooth_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down
12 changes: 12 additions & 0 deletions generated/nirfmxinstr/nirfmxinstr_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,9 @@ namespace nirfmxinstr_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -1898,6 +1901,9 @@ namespace nirfmxinstr_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -1933,6 +1939,9 @@ namespace nirfmxinstr_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -1974,6 +1983,9 @@ namespace nirfmxinstr_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions generated/nirfmxlte/nirfmxlte_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4241,6 +4241,9 @@ namespace nirfmxlte_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -4276,6 +4279,9 @@ namespace nirfmxlte_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions generated/nirfmxnr/nirfmxnr_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3324,6 +3324,9 @@ namespace nirfmxnr_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -3359,6 +3362,9 @@ namespace nirfmxnr_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions generated/nirfmxspecan/nirfmxspecan_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7727,6 +7727,9 @@ namespace nirfmxspecan_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -7762,6 +7765,9 @@ namespace nirfmxspecan_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions generated/nirfmxwlan/nirfmxwlan_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2641,6 +2641,9 @@ namespace nirfmxwlan_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -2676,6 +2679,9 @@ namespace nirfmxwlan_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions generated/nirfsa/nirfsa_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2283,6 +2283,9 @@ namespace nirfsa_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -2320,6 +2323,9 @@ namespace nirfsa_grpc {
catch (nidevice_grpc::LibraryLoadException& ex) {
return ::grpc::Status(::grpc::NOT_FOUND, ex.what());
}
catch (nidevice_grpc::SessionException& ex) {
return ::grpc::Status(::grpc::INVALID_ARGUMENT, ex.what());
}
}

//---------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 07f685d

Please sign in to comment.