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

Unclear error message for invalid extra-package-dbs #1738

Open
pakanek opened this issue Feb 4, 2016 · 1 comment
Open

Unclear error message for invalid extra-package-dbs #1738

pakanek opened this issue Feb 4, 2016 · 1 comment

Comments

@pakanek
Copy link

pakanek commented Feb 4, 2016

Steps to reproduce
Add invalid value to extra-package-dbs eg.

extra-package-dbs:
- ghc-datasize-0.1.2
stack build

Expected

Database 'ghc-datasize-0.1.2' does not exist

Actual

ghc-datasize-0.1.2: canonicalizePath: does not exist (No such file or directory)
$ stack --version
Version 1.0.2, Git revision fa09a980d8bb3df88b2a9193cd9bf84cc6c419b3 (3084 commits) x86_64

ghc-datasize belongs to extra-deps (my mistake). Error message does not tell you that stack is looking for database instead of package.

@mitchellwrosen
Copy link
Contributor

I think it makes sense to standardize have one "directory not found" exception, and share it everywhere.

There is a NoSuchDirectory constructor in Stack.Types.Config.ConfigException, but Stack.Config is not the only module that calls resolveDir/resolveDir':

src/Stack/Config.hs:316:                     Nothing -> resolveDir' userPath
src/Stack/Config.hs:318:                     Just (_, configYaml) -> resolveDir (parent configYaml) userPath)
src/Stack/Config.hs:538:    extraPackageDBs <- mapM resolveDir' (projectExtraPackageDBs project)
src/Stack/Config.hs:566:            subs -> mapM (resolveDir entryRoot) subs
src/Stack/Config.hs:597:resolvePackageLocation _ projRoot (PLFilePath fp) = resolveDir projRoot fp
src/Stack/Coverage.hs:279:            dest <- resolveDir' destDir
src/Stack/Fetch.hs:151:    dest' <- resolveDir' dest
src/Stack/GhcPkg.hs:60:    resolveDir' fp
src/Stack/Image.hs:113:              do sourcePath <- resolveDir (bcRoot bconfig) source
src/Stack/Init.hs:75:    dirs <- mapM (resolveDir' . T.unpack) (searchDirs initOpts)
src/main/Main.hs:688:                pkgDir <- resolveDir' dir
src/main/Main.hs:707:            else mapM resolveDir' dirs

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