Suggestion: Add a helpful error message when app.yaml has syntax errors

When making changes to app.yaml (to add a plugin for instance), it is easy to include extra space, forget a dash, etc. An incorrectly formatted YAML file causes launcher rebuild app to fail with the following error:

/merge_command.rb:45:in `merge': no implicit conversion of String into Hash

The error code and description in no way imply that there is an issue with parsing app.yaml, nor does it indicate what the problem is with the file. Googling the above error does contain a couple of support links that suggest the issue, but it is far from clear.

Could an error message be added that, at a minimum, indicated that the build tool failed to parse app.yaml, or even better, indicate what the syntax or parsing error was (e.g. “expected indentation on line 17 but found <tab>”, orsimilar)

4 Likes

This is really more of a limitation of the YAML file format than anything else.

About all you can do is pass it to a YAML validator beforehand, but there are lots of ways to mess up a YAML file that keep it technically valid but not working for the settings we’re looking for.

Anything else to add here @sam?

3 Likes

Would it be possible to store the settings in say, app.json and let launcher create a YAML file out of that?

1 Like

We could try to validate the YAML using the yamllint package.

For example, if I try to add a plugin using tabs instead of spaces in the app.yml:

âžś yamllint -d "{extends: relaxed, rules: {line-length: {max: 9999999}}}" standalone.yml
standalone.yml

  92:1      error    syntax error: found character '\t' that cannot start any token

Is that error above any better?

1 Like

I am not against writing a “semantic” validator that ensures we know about all the keys and all the keys have the right kind of values in them, but it would be a fair bit of work.

2 Likes

Yes, an error of that sort would definitely have told me that the problem was with my app.yaml file. Even an error just stating that there was an issue with that file would be helpful. This wouldn’t require any kind of linting library.

4 Likes