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

Confusing Error: getDirectoryContents:openDirStream: does not exist #40

Open
bitc opened this issue Oct 21, 2021 · 2 comments
Open

Confusing Error: getDirectoryContents:openDirStream: does not exist #40

bitc opened this issue Oct 21, 2021 · 2 comments

Comments

@bitc
Copy link

bitc commented Oct 21, 2021

If the cabal file has a line such as:

  hs-source-dirs:   src

but the src directory does not exist, then cabal-fmt gives the error message:

cabal-fmt: ./src: getDirectoryContents:openDirStream: does not exist (No such file or directory)

This error message is confusing for the user, because it is not clear what the reason for it is. A better error message would be to tell the user the relevant line of code in the .cabal file, with a clearer explanation that the directory does not exist (or is not readable). Even better would be to just treat non-existent directory as empty, and proceed to format the file.

Thank you

@phadej
Copy link
Owner

phadej commented Oct 22, 2021

I cannot reproduce this. cabal-fmt doesn't look into hs-source-dirs, i'm confused.

@bitc
Copy link
Author

bitc commented Oct 22, 2021

Oops, I got confused a little bit. The error happens as a result of a cabal-fmt expand annotation, such as:

-- cabal-fmt: expand src

I still believe a better error message should be produced (or possibly just a warning, while still formatting the file)

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

No branches or pull requests

2 participants