Skip to content

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

Open
@a-dubs

Description

@a-dubs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions