canonical / canonical/pycloudlib

Improve IBM exceptions to be less generic and use more specific exceptions

Open
#427 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
22
Forks
42
PR merge metrics
No merged PRs in 30d

Description

From @blackboxsw in PR #420:

Also, i'm not a big fan of our generic IBMException for any IBM error (not due to this PR). We should specialize errors so we know what to report to end-users. In server team case, we happen to name our floating ip's differently than the "default-floating-ip, we I get the following traceback from integration tests:
```
if not floating_ips:
> raise IBMException(
f"No floating IPs found matching substring {name_includes}"
)
E pycloudlib.ibm.errors.IBMException: No floating IPs found matching substring default-floating-ip
```

For a separate PR: what I'd rather see is a raised exception that is a subclass of pycloudlib.errors.ResourceNotFoundError (maybe named FloatingIPNotFoundError). Then I can have a try/except FloatingIPNotFoundError around the launch to better inform the integration-test runner that they haven't pre-allocated the expected availble floating-ips in order to run the test

That comment about subclassing ResourceNotFoundErrors in IBM applies to many of the errors generated by pycloudlib.ibm.instance which can probably be taken to a separate issue/PR

"Subnet not found"
No subnet associated to vpc found
VPC not found
No subnet available

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.