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

Better error message when track/problem can't be identified #261

Merged
merged 3 commits into from
Dec 13, 2015

Conversation

anxiousmodernman
Copy link
Contributor

I've created two error messages for two scenarios.

  1. If submit is called outside of the configured exercises directory, use the msgSubmitCalledFromWrongDir template
  2. If submit is called inside the configured exercises directory, but the path seems weird, use msgGenericPathError template. I was able to simulate this error like this:
cd ~/exercism   # my exercism home
mkdir tmp
cd tmp
touch Clock.go
exercism submit Clock.go

Happy to rework any of this. 🎅 🎄 🎁

I used text/template because the messages were quite long. The iterationError type is not necessary, strictly speaking, but I'd like to know what the rest of the team thinks.

It was mentioned in #197 that we could suggest the proper path. I am unsure how to do that without having some kind of lookup based on file extension and the exercise slug. Even if I know that the file they're trying to submit is JavaScript, how can I tell it's the hello-world problem when they're submitting from a bad path/location?

exercises directory, and another for submitting inside the directory
but with a bad internal path.

The latter might happen if the user messes with their directories
inside of their configured exercises directory. We print a detailed
message, which is hopefully helpful.
For example, to submit the JavaScript "hello-world.js" problem, run
"exercism submit hello-world.js" from this directory:

{{ .Configured }}/javascript/helloworld
Copy link
Member

Choose a reason for hiding this comment

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

s/helloworld/hello-world

@kytrinyx
Copy link
Member

This looks great! I really like the clarity of these error messages, and I think using a text/template was a really good call. I have a few minor comments.

the slashes like `\` instead of `/`. This requires passing an
additional Separator variable to our template.
@anxiousmodernman
Copy link
Contributor Author

I think this is done. Please review when you are able.

@kytrinyx
Copy link
Member

Thanks so much for taking the time to work through this so thoroughly!

kytrinyx added a commit that referenced this pull request Dec 13, 2015
Better error message when track/problem can't be identified
@kytrinyx kytrinyx merged commit 0272e15 into exercism:master Dec 13, 2015
@anxiousmodernman anxiousmodernman deleted the better-error-2335 branch December 14, 2015 02:26
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