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

Change compile error printing/throwing logic #127

Merged
merged 3 commits into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chanterelle",
"version": "5.0.1",
"version": "5.1.0",
"description": "A more functional truffle",
"license": "ISC",
"scripts": {
Expand Down
8 changes: 7 additions & 1 deletion src/Chanterelle/Internal/Compile.purs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,13 @@ decodeModuleOutput moduleName (ST.CompilerOutput output) = do
isSolcWarning (ST.FullCompilationError se) = se.severity == ST.SeverityWarning
isSolcWarning _ = false
({ yes: warnings, no: errors }) = partition isSolcWarning output.errors
for_ warnings (logSolcError moduleName)
isModuleError (ST.FullCompilationError se) = fromMaybe false ado
ST.SourceLocation fesl <- se.sourceLocation
in fesl.file == moduleFilename
isModuleError _ = false
({ yes: moduleErrors, no: otherErrors }) = partition isModuleError errors
for_ (warnings <> otherErrors) (logSolcError moduleName)
unless (moduleErrors == mempty) $ throwError $ CompilationError { moduleName, errors: moduleErrors }
case M.lookup moduleFilename output.contracts of
Nothing -> throwError $ CompilationError { moduleName, errors }
Just contractMap' -> pure contractMap'
Expand Down