Skip to content

Be more helpful when generator can not be found#646

Merged
kotp merged 4 commits intoexercism:masterfrom
Insti:Be_more_helpful_when_generator_can_not_be_found
May 21, 2017
Merged

Be more helpful when generator can not be found#646
kotp merged 4 commits intoexercism:masterfrom
Insti:Be_more_helpful_when_generator_can_not_be_found

Conversation

@Insti
Copy link
Copy Markdown
Contributor

@Insti Insti commented May 15, 2017

Resolves #644

In #583 there was a problem with the generator not being found:

$ bin/generate space-age
A generator does not currently exist for space-age!

This patch adds a bit more information to the error message about where the generator expected to find the file it needs.

A generator does not currently exist for space-age!
Expecting it to be at: <user_specific_path>/exercises/space-age/.meta/generator/space_age_case.rb

Insti added 2 commits May 15, 2017 15:28
Improve error output by providing information about where it expects to
find the generator cases file.
$stderr.puts "A generator does not currently exist for #{options[:slug]}!"
error_message = "A generator does not currently exist for #{options[:slug]}!"
expected_locations = "Expecting it to be at: #{Files::GeneratorCases.source_filepath(@paths.track, options[:slug])}"
$stderr.puts [error_message, expected_locations].join("\n")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This isn't raising so error_message should probably be simply message.

@kotp
Copy link
Copy Markdown
Member

kotp commented May 21, 2017

Looks good to me, other than the variable name. I looked for where it was raising, and couldn't find it, so it caused me some extra "investigation" to realize that it was not going to do that... the name leads me to search, without it, I know it is just a message with no further expectations, other than perhaps output somewhere.

Insti added 2 commits May 21, 2017 22:37
Since we're not actually raising an error, just outputting a warning
message to $stderr.
return true if available_generators.include?(options[:slug])
$stderr.puts "A generator does not currently exist for #{options[:slug]}!"
warning = "A generator does not currently exist for #{options[:slug]}!"
expected_location = "Expecting it to be at: #{Files::GeneratorCases.source_filepath(@paths.track, options[:slug])}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good catch

@kotp kotp merged commit 5130510 into exercism:master May 21, 2017
@kotp kotp removed the ready label May 21, 2017
@kotp
Copy link
Copy Markdown
Member

kotp commented May 21, 2017

Thanks @Insti

@Insti Insti deleted the Be_more_helpful_when_generator_can_not_be_found branch May 21, 2017 21:57
@Insti Insti removed the ready label Jun 8, 2017
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.

2 participants