Skip to content

CNI CMD Add - Avoid relying on err var in cleanup #233

@adrianchiris

Description

@adrianchiris

Currently if cmdAdd function fails, we rely on top level err error variable to determine if cleanup needs to occur via defer statements [1]
This is brittle as err variable may be re-declared in inner-scope masking it and in case of error in inner scope causing the deferred functions to behave in an un-desirable manner (essentially do nothing)

we should come up with a better mechanism for cleanup. it might not look pretty but it should be more robust.

[1]

defer func() {

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions