fix(pkg/action): Configuration.Init should not panic

Since the method have a error type return value,
it should not panic in method body.

Signed-off-by: wuhuizuo <wuhuizuo@126.com>
pull/9690/head
wuhuizuo 4 years ago
parent 43853ea772
commit c405e86cd7

@ -403,12 +403,12 @@ func (c *Configuration) Init(getter genericclioptions.RESTClientGetter, namespac
namespace, namespace,
) )
if err != nil { if err != nil {
panic(fmt.Sprintf("Unable to instantiate SQL driver: %v", err)) return errors.Wrap(err, "Unable to instantiate SQL driver")
} }
store = storage.Init(d) store = storage.Init(d)
default: default:
// Not sure what to do here. // Not sure what to do here.
panic("Unknown driver in HELM_DRIVER: " + helmDriver) errors.Errorf("Unknown driver in HELM_DRIVER: %s", helmDriver)
} }
c.RESTClientGetter = getter c.RESTClientGetter = getter

Loading…
Cancel
Save