Skip to content
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

Clean up exceptions in DAQ betterproto examples #280

Merged
merged 1 commit into from
Jul 30, 2021

Conversation

astarche
Copy link
Collaborator

What does this Pull Request accomplish?

Fix DAQ betterproto examples to print better exceptions, especially in common error cases.

Note that betterproto does not report GRPCErrors for connection failures. Those are reported as OSError or TimeouError, which do not provide much structure.

Sample output:

Connection errors (different cases):

> python digital-input-betterproto.py localhost 31763 "gRPCSystemTestDAQ/port0"                                                                                                                                                               
Multiple exceptions: [Errno 10061] Connect call failed ('::1', 31763, 0, 0), [Errno 10061] Connect call failed ('127.0.0.1', 31763)

> python digital-input-betterproto.py 0.0.0.0 31763 "gRPCSystemTestDAQ/port0"                                                                                                                                                                 
[Errno 10049] Connect call failed ('0.0.0.0', 31763)

> python digital-input-betterproto.py 10.0.62.17 31763 "gRPCSystemTestDAQ/port0"
[Errno 10060] Connect call failed ('10.0.62.17', 31763)

UNIMPLEMENTED error:

> python digital-input-betterproto.py 10.0.62.17 31763 "gRPCSystemTestDAQ/port0"
The operation is not implemented or is not supported/enabled in this service

Other GRPC error:

> python digital-input-betterproto.py 10.0.62.17 31763 "gRPCSystemTestDAQ/port0"
GRPCError: (<Status.SOMETHINGELSE: 12345>, None, None)

Error from DAQ/raise_if_error:

> python digital-input-betterproto.py 10.0.62.17 31763 "gRPCSystemTestDAQ/not-a-port"
Error: Device identifier is invalid.

Why should this Pull Request be merged?

Simple implementation to provide reasonable errors for betterproto examples.

What testing has been done?

Ran examples in various success and failure cases.

@astarche astarche merged commit 37f9ea9 into ni:main Jul 30, 2021
@astarche astarche deleted the users/astarche/fix-better-exceptions branch July 30, 2021 20:54
astarche added a commit to astarche/grpc-device that referenced this pull request Aug 2, 2021
…xperimental-callbacks

* origin/main:
  Adding a workflow to create AzDO bugs from 'Issues' created on the repo (ni#253)
  Clean up exceptions in DAQ betterproto examples (ni#280)
  Improve DAQ examples (ni#279)
  Add DAQmx Advanced functions to grpc-device (ni#283)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants