refactor: introduce exit-code guard against InternalError
This commit is contained in:
parent
756b42dd72
commit
b7e442b269
@ -39,8 +39,15 @@ def compile(contents: String): Int = {
|
||||
typeChecker.check(prog)
|
||||
if (errors.result.nonEmpty) {
|
||||
given errorContent: String = contents
|
||||
errors.result.foreach(printError)
|
||||
200
|
||||
errors.result
|
||||
.map { error =>
|
||||
printError(error)
|
||||
error match {
|
||||
case _: Error.InternalError => 201
|
||||
case _ => 200
|
||||
}
|
||||
}
|
||||
.max()
|
||||
} else 0
|
||||
case Failure(msg) =>
|
||||
println(msg)
|
||||
|
Loading…
x
Reference in New Issue
Block a user