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

give better errors for broken templates #1555

Merged
merged 2 commits into from
Dec 22, 2015

Conversation

kadoban
Copy link
Collaborator

@kadoban kadoban commented Dec 22, 2015

fixes #1535

@kadoban
Copy link
Collaborator Author

kadoban commented Dec 22, 2015

Upon review, the error messages sound rather badly worded; I'll fix them up in the morning.

@kadoban kadoban force-pushed the template-edge-cases branch from 7fc1f82 to c3674b0 Compare December 22, 2015 18:09
@kadoban
Copy link
Collaborator Author

kadoban commented Dec 22, 2015

I think I'm happier with these errors, and it seems to work fine:

~/testing$ touch blah.hsfiles
~/testing$ stack new blah blah                 
Loading local template "blah" to create project "blah" in blah/ ...
The template "blah" is invalid and could not be used. The error was: "Template does not contain any files"
~/testing$ printf "{-# START_FILE BOGUS #-}\n" > blah.hsfiles
~/testing$ stack new blah blah
Loading local template "blah" to create project "blah" in blah/ ...
The template "blah" is invalid and could not be used. The error was: "Template does not contain a .cabal file"
~/testing$ printf "a b c d e" > blah.hsfiles
~/testing$ stack new blah blah
Loading local template "blah" to create project "blah" in blah/ ...
The template "blah" is invalid and could not be used. The error was: "InvalidInput "a b c d e""

Note that although the empty template error is technically redundant (it'll obviously be missing a .cabal file too in that case), I think it's probably still useful since it probably points to an empty template rather than one that someone forgot to add a .cabal file to.

@mgsloan
Copy link
Contributor

mgsloan commented Dec 22, 2015

LGTM, thanks!

mgsloan added a commit that referenced this pull request Dec 22, 2015
give better errors for broken templates
@mgsloan mgsloan merged commit 1d18803 into commercialhaskell:master Dec 22, 2015
@kadoban kadoban deleted the template-edge-cases branch December 27, 2015 00:25
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.

edge cases in broken templates give odd errors
2 participants