zowe / zowe-cli

Zowe CLI
Eclipse Public License 2.0
108 stars 85 forks source link

Function to validate that credential manager will load successfully after `ProfilesInfo` constructor called #2111

Closed rudyflores closed 1 week ago

rudyflores commented 2 months ago

Is your feature or enhancement request related to a problem or limitation? Please describe

In Zowe Explorer, we utilize the ProfilesInfo API for loading our default and custom credential managers. Our issue is that when calling the constructor we expect the credential manager to be loaded during initialization, but instead the credential manager is loaded until readProfilesFromDisk is called.

Describe your enhancement idea

For this issue, I would like for the ProfilesInfo API to provide a way to check early whether or not the credential manager will fail when loading, so that way we won't rely on the readProfilesFromDisk function that can be called in multiple locations and can be harder to trace.

Describe alternatives you've considered

My current alternative is to call await profileInfo.readProfilesFromDisk() after the constructor in a try/catch that will catch error and handle accordingly, although not great since it uses the entire part of the readProfilesFromDisk code if successful, it currently is the only way to catch this error early, which is not conventional.

Provide any additional context

Imperative code screenshots:

image

image

image

github-actions[bot] commented 2 months ago

Thank you for raising this enhancement request. The community has 90 days to vote on it. If the enhancement receives at least 5 upvotes, it is added to our development backlog. If it receives fewer votes, the issue is closed.