Failed network element creation leads to the return of false error messages
There are multiple occasions of the wrong error usage within controller/northbound/server/networkelement.go
in the addMne
method (https://code.fbi.h-da.de/danet/gosdn/-/blob/b406addb4a7965c7f7a0eac769ca72d7f9115802/controller/northbound/server/networkElement.go#L571)
Description
One example of a typo:
if err != nil {
if pluginRmErr := plugin.Remove(); err != nil {
return uuid.Nil, pluginRmErr
}
return uuid.Nil, err
}
which should be:
if err != nil {
if pluginRmErr := plugin.Remove(); pluginRmerr != nil {
return uuid.Nil, pluginRmErr
}
return uuid.Nil, err
}
Expected Behavior
The correct error should be returned
Actual Behavior
Wrong errors are returned and therefore sometimes a nil error is returned.
Possible Fix
Typos like the one I've mentioned above should be addressed. But in general I think a better way would be to do the clean up of a plugin within a defer
function.
Steps to Reproduce
Context
Your Environment
- Version used:
- Environment name and version (e.g. go v1.16.3 on FreeBSD 13.0-current):
- Server type and version:
- Operating System and version: