fix: fix incorrect semantic error logging by refactoring error.scala from frontend
This commit is contained in:
@@ -53,14 +53,15 @@ def frontend(
|
||||
|
||||
if (errors.result.isEmpty) IO.pure(Right(typedProg))
|
||||
else {
|
||||
given errorContent: String = contents
|
||||
val exitCode = errors.result.view.map {
|
||||
case _: Error.InternalError => 201
|
||||
case _ => 200
|
||||
}.max
|
||||
|
||||
logger.error(s"Semantic errors:\n${errors.result.mkString("\n")}") *> IO.pure(
|
||||
Left(exitCode)
|
||||
)
|
||||
val formattedErrors = errors.result.map(formatError).mkString("\n")
|
||||
|
||||
logger.error(s"Semantic errors:\n$formattedErrors") *> IO.pure(Left(exitCode))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user