Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show a user-friendly error when config file doesn't exist or is not readable #220

Closed
4 tasks done
ppapapetrou76 opened this issue Mar 18, 2020 · 1 comment · Fixed by #254
Closed
4 tasks done

Comments

@ppapapetrou76
Copy link
Contributor

ppapapetrou76 commented Mar 18, 2020

Readiness Checklist

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I am reporting the issue to the correct repository (for multi-repository projects)

Expected Behavior

When the config file used does not exist, the user should be informed with a user-friendly message

Current Behavior

No error is reported. Instead, a not-very-helpful message is displayed

$ ecl platform region list --config wrong-file
1 error occurred:
	* apikey or user and pass must be specified

Possible Solution

Check for config file existence and show a user-friendly message

Steps to Reproduce

Just run any command by providing a config file value pointing to a file that doesn't exist

Context

Maybe this is happening also even if the config file exists but its contents cannot be read.
I assume we need to handle that case too

Your Environment

  • Version used: 1.0.0-beta2
@marclop
Copy link
Collaborator

marclop commented Mar 23, 2020

Requires elastic/cloud-sdk-go#81 to be merged

marclop added a commit that referenced this issue Apr 8, 2020
This change changes the `ecctl.<struct>.Validate()` functions
multierrors to use `cloud-sdk-go/pkg/multierror.Prefixed` to improve the
quality of our errors to always use prefixes.

Additionally, changes the behavior when the ecctl.App fails to be
initialized and the config file used is empty (unexisting, or failed to
read) to throw an error which instructs the user to run "ecctl init".

Resolves #223.
Resolves #220.

Signed-off-by: Marc Lopez <marc5.12@outlook.com>
@marclop marclop added this to the 39: Apr 8 - Apr 28 milestone Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants