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

new-build produces bad error message on missing cabal.project #3636

Closed
BardurArantsson opened this issue Jul 28, 2016 · 10 comments
Closed

new-build produces bad error message on missing cabal.project #3636

BardurArantsson opened this issue Jul 28, 2016 · 10 comments

Comments

@BardurArantsson
Copy link
Collaborator

If the cabal.project file is missing cabal new-build produces the rather opaque error message

BadPackageLocations [BadLocGlobEmptyMatch "./*.cabal"]

It should probably print something more informative. :)

@BardurArantsson
Copy link
Collaborator Author

Oh, and the exact cabal-install version I'm running is commit b7b666e

@dcoutts
Copy link
Contributor

dcoutts commented Aug 11, 2016

Just need to add displayException method to the instance Exception BadPackageLocations to give a nice human readable message.

@BardurArantsson
Copy link
Collaborator Author

Sigh... I suppose the labels mean that I really should do this...? I'm just (semi-)joking, I'd be happy to, given the hint.

Aside: Why are we relying on overriding defaults in this manner? Shouldn't we just have a (huge) sum type for every single error that Cabal/cabal-install can show and then be forced to implement a human-readable error message? (I'm sure I'm doing a "couldn't we just..." type thing here, but...)

(Assigning to self in the hope of finally starting to contribute to Cabal again.)

@BardurArantsson BardurArantsson self-assigned this Aug 12, 2016
@ezyang
Copy link
Contributor

ezyang commented Aug 12, 2016

@BardurArantsson, if you want to rip out and rewrite all of the error reporting code in cabal-install, I will support the endeavor. But I'd want to see some sort of style guideline come out of it, saying, "This is how we deal with error reporting in cabal-install" (and ideally also, "here's why"). So that if I'm a not-paying-very-much-attention developer and I need to add an error, I know what to do, it is not hard to do "the right thing".

@alanz
Copy link
Collaborator

alanz commented Aug 29, 2016

Ping @BardurArantsson: Are you still working on this? I'm looking for a trivial getting started issue.

@BardurArantsson
Copy link
Collaborator Author

No, it fell through the cracks. Feel free to take a swing at it.

@dcoutts
Copy link
Contributor

dcoutts commented Sep 8, 2016

Could someone check what this does now (since #3774 added proper messages), and suggest changes to the error message that would make it more appropriate for the situation where there is no explicit cabal.project file. The current message is written assuming there is one and the user groks this.

If someone (@alanz ?) wants to look at this, you'd want to extend the plumbing so that the exception we throw contains info on whether or not the project config was from an implicit project file on an explicit one (perhaps even with file path location). This would probably require extending the ProjectConfig itself with a field that says if it originated from a implicit or explicit cabal.project (again, perhaps with file path).

@ezyang
Copy link
Contributor

ezyang commented Sep 8, 2016

Same old:

ezyang@sabre:~/Dev/labs$ cabal-shake new-build
BadPackageLocations [BadLocGlobEmptyMatch "./*.cabal"]

@dcoutts
Copy link
Contributor

dcoutts commented Sep 15, 2016

@ezyang what is cabal-shake doing? Does its top level exception handler use show or displayException ?

@ezyang
Copy link
Contributor

ezyang commented Sep 15, 2016

Oh, the alias was pointing at an old binary. OK this is fixed in HEAD.

@ezyang ezyang closed this as completed Sep 15, 2016
Rufflewind added a commit to Rufflewind/cabal that referenced this issue Sep 23, 2017
Send all diagnostic messages (debug, info, notice) to stderr instead of
stdout.  Likewise, redirect GHC's stdout to stderr as GHC sends progress
output to stdout due to GHC Trac haskell#3636.
Rufflewind added a commit to Rufflewind/cabal that referenced this issue Sep 25, 2017
Send all diagnostic messages (including debug, info, notice) to stderr
instead of stdout.  Likewise, redirect GHC's stdout to stderr as GHC
sends progress output to stdout due to GHC Trac haskell#3636.
Rufflewind added a commit to Rufflewind/cabal that referenced this issue Sep 27, 2017
Send all diagnostic messages (including debug, info, notice) to stderr
instead of stdout.  Likewise, redirect GHC's stdout to stderr as GHC
sends progress output to stdout due to GHC Trac haskell#3636.
Rufflewind added a commit to Rufflewind/cabal that referenced this issue Sep 27, 2017
Send all diagnostic messages (including debug, info, notice) to stderr
instead of stdout.  Likewise, redirect GHC's stdout to stderr as GHC
sends progress output to stdout due to GHC Trac haskell#3636.
Rufflewind added a commit to Rufflewind/cabal that referenced this issue Jan 2, 2020
Send all diagnostic messages (including debug, info, notice) to stderr
instead of stdout.  Likewise, redirect GHC's stdout to stderr as GHC
sends progress output to stdout due to GHC Trac haskell#3636.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants