Skip to content

Commit

Permalink
Updates error message
Browse files Browse the repository at this point in the history
  • Loading branch information
infomiho committed Jul 8, 2024
1 parent 24f40aa commit 6d25f95
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions waspc/src/Wasp/Project/Analyze.hs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ analyzePackageJsonContent waspProjectDir =
Just packageJsonFile -> readPackageJsonFile packageJsonFile
Nothing -> return $ Left [fileNotFoundMessage]
where
fileNotFoundMessage = "couldn't find package.json file in the " ++ toFilePath waspProjectDir ++ " directory"
fileNotFoundMessage = "Couldn't find the package.json file in the " ++ toFilePath waspProjectDir ++ " directory"

findPackageJsonFile :: Path' Abs (Dir WaspProjectDir) -> IO (Maybe (Path' Abs File'))
findPackageJsonFile waspProjectDir = findFileInWaspProjectDir waspProjectDir packageJsonInWaspProjectDir
Expand All @@ -152,11 +152,16 @@ analyzePrismaSchema waspProjectDir = do

case Psl.Parser.parsePrismaSchema prismaSchemaContent of
Left err ->
return (Left [waspCouldntParsePrismaSchemaMessage ++ "\n\n" ++ show err], [])
return (Left [couldntParsePrismaSchemaMessage ++ "\n\n" ++ show err], [])
Right parsedPrismaSchema -> return $ runValidation PslV.validatePrismaSchema parsedPrismaSchema
Nothing -> return (Left ["Couldn't find the Prisma schema file in the " ++ toFilePath waspProjectDir ++ " directory"], [])
Nothing -> return (Left [couldntFindPrismaSchemaMessage], [])
where
waspCouldntParsePrismaSchemaMessage = "Wasp couldn't parse your Prisma schema file, please check if you have any errors in it."
couldntParsePrismaSchemaMessage = "Wasp couldn't parse your schema.prisma file, please check if you have any errors in it."

-- NOTE: linking here to migration docs because I think it's the most common reason why schema.prisma file is missing.
-- After people mostly start using 0.14.0+ they will have schema.prisma file, so this message will be less relevant.
-- If we see that this message is still relevant, we can change it to be more general.
couldntFindPrismaSchemaMessage = "Couldn't find the schema.prisma file in the " ++ toFilePath waspProjectDir ++ " directory. \nRead more: https://wasp-lang.dev/docs/migrate-from-0-13-to-0-14#migrate-to-the-new-schemaprisma-file"

runValidation :: (result -> [ValidationError]) -> result -> (Either [CompileError] result, [CompileWarning])
runValidation getErrorsAndWarnings result =
Expand Down

0 comments on commit 6d25f95

Please sign in to comment.