chore: only mention cabal.project issue for parser errors

This commit is contained in:
Sridhar Ratnakumar 2024-04-22 20:34:33 +10:00
parent f2153d02be
commit 462f004e30
2 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,7 @@
{ pkgs
, lib
, throwError ? builtins.throw
, throwErrorOnCabalProjectParseError ? builtins.throw
, ...
}:
@ -49,13 +50,13 @@ in
if isSelfPath path
then projectRoot
else if lib.strings.hasInfix "*" path
then throwError "Found a path with glob (${path}) in ${cabalProjectFile}, which is not supported"
then throwErrorOnCabalProjectParseError "Found a path with glob (${path}) in ${cabalProjectFile}, which is not supported"
else if lib.strings.hasSuffix ".cabal" path
then throwError "Expected a directory but ${path} (in ${cabalProjectFile}) is a .cabal filepath"
then throwErrorOnCabalProjectParseError "Expected a directory but ${path} (in ${cabalProjectFile}) is a .cabal filepath"
else "${projectRoot}/${path}"
)
res.value
else throwError "Failed to parse ${cabalProjectFile}: ${builtins.toJSON res}"
else throwErrorOnCabalProjectParseError "Failed to parse ${cabalProjectFile}: ${builtins.toJSON res}"
else
[ projectRoot ];
in

View File

@ -41,6 +41,12 @@ in
A default value for `packages` cannot be auto-determined:
${msg}
'';
throwErrorOnCabalProjectParseError = msg: config.log.throwError ''
A default value for `packages` cannot be auto-determined:
${msg}
haskell-flake's `cabal.project` parser is limited; see #307.
Please specify the `packages` option manually or modify your