- Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Description
Related to #2861
We need to add bunch of fixtures for more robust tests. However, this is difficult now because the current sample code often does something like this:
try: response = client.create_device_registry(parent, body) print('Created registry') return response except HttpError: print('Error, registry not created') return "" except AlreadyExists: print('Error, registry already exists') return ""
This is bad because of the following reasons:
- It throws away all the details about the exception.
- The caller can not distinguish HttpError from AlreadyExists because the return values are the same.
I think we should re-raise the exception (it's good to have these except
clauses to show how to handle exceptions).
I'm going to fix it first before building the fixture for #2861
@gguuss FYI
Metadata
Metadata
Assignees
Labels
No labels