zowe / zowe-cli-secrets-for-kubernetes

Eclipse Public License 2.0
0 stars 0 forks source link

Enhance error message when credential manager fails to initialize #15

Closed t1m0thyj closed 7 months ago

t1m0thyj commented 1 year ago

Currently if the K8s readNamespace API fails, and the error code is not 401 or 403, we assume that "namespace does not exist" in the error message: https://github.com/zowe/zowe-cli-secrets-for-kubernetes/blob/bd43346bddb54c2bb8550c9c31f187e582a4afc7/packages/cli/src/credentials/K8sCredentialManager.ts#L65-L67

This message can be misleading as the error might have been caused by a different reason. I suggest that we preserve the original error message to aid in debugging - something like the following:

            throw new ImperativeError({
                msg: `Failed to read namespace ${this.kubeConfig.namespace}: ${err}`,
            });
traeok commented 1 year ago

Here's what the error looks like in Zowe Explorer:

image

I expected the error to occur, but with 3 errors in the message it might not be obvious to end-users as to why the credential manager failed to load.

github-actions[bot] commented 1 year ago

Thank you for creating a bug report. We will investigate the bug and evaluate its impact on the product. If you haven't already, please ensure you have provided steps to reproduce the bug and as much context as possible.