Skip to content

Update Config.rb to raise error on badly formatted yaml#243

Merged
denmat merged 2 commits intomasterfrom
update_config_errors
Jun 15, 2018
Merged

Update Config.rb to raise error on badly formatted yaml#243
denmat merged 2 commits intomasterfrom
update_config_errors

Conversation

@denmat
Copy link
Copy Markdown
Contributor

@denmat denmat commented Jun 15, 2018

With badly formatted yaml I get this error message, which usually takes some time for me to remember what the problem is.

stack_master validate
error: (<unknown>): mapping values are not allowed in this context at line 19 column 19. Use --trace to view backtrace

Now, this helps me remember in a 🔦 :

stack_master validate
error: Unable to parse <path-to-stack_master.yml>: (<unknown>): mapping values are not allowed in this context at line 19 column 19. Use --trace to view backtrace

Comment thread lib/stack_master/config.rb Outdated
base_dir = File.dirname(File.expand_path(resolved_config_file))
new(config, base_dir)
rescue Psych::SyntaxError => error
raise ConfigParseError, "Unable to parse stack_master.yml: #{error}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd love it if we could create our own wrapper for yaml parser and catch this, it's a pain in parameter files and templates too

Comment thread lib/stack_master/config.rb Outdated
base_dir = File.dirname(File.expand_path(resolved_config_file))
new(config, base_dir)
rescue Psych::SyntaxError => error
raise ConfigParseError, "Unable to parse stack_master.yml: #{error}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

stack_master.yml is hardcoded in the message. Should it be #{config_file} instead?

Copy link
Copy Markdown
Contributor Author

@denmat denmat Jun 15, 2018

Choose a reason for hiding this comment

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

Yes, it should be stack_master.yml anyways, but using the resolved_config_file would probably help more too. See d62f9ba

@denmat denmat merged commit e828d0b into master Jun 15, 2018
@denmat denmat deleted the update_config_errors branch June 15, 2018 04:52
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 this pull request may close these issues.

4 participants