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

Override error message in compute init #204

Merged
merged 6 commits into from
Feb 18, 2021
Merged

Conversation

kailan
Copy link
Member

@kailan kailan commented Feb 11, 2021

As reported by @ezambrano-fastly, users without the C@E feature flag enabled currently see a relatively cryptic message: "Unable to create service: valid values for 'type' are: 'vcl'"

Copy link
Collaborator

@Integralist Integralist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One requested change, but approved still.

@@ -355,6 +355,12 @@ func (c *InitCommand) Exec(in io.Reader, out io.Writer) (err error) {
Comment: description,
})
if err != nil {
if strings.Contains(err.Error(), "Valid values for 'type' are: 'vcl'") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using strings.Contains for checking an error always make me a little nervous due to its brittle nature. Sadly I'm not sure if there's a way around this. I just wanted to vocalise that this might be a problem that resurfaces if the backend API ever changes the text content.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this is not great – we would want an error code to match on in an ideal world. For now this will have to do though, unless anyone has any suggestions.

pkg/compute/init.go Outdated Show resolved Hide resolved
@kailan kailan merged commit d557946 into master Feb 18, 2021
@kailan kailan deleted the kailan/ecp-feature-error branch February 18, 2021 10:13
@Integralist Integralist added the bug Something isn't working label Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants