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)
|
typeChecker.check(prog)
|
||||||
if (errors.result.nonEmpty) {
|
if (errors.result.nonEmpty) {
|
||||||
given errorContent: String = contents
|
given errorContent: String = contents
|
||||||
errors.result.foreach(printError)
|
errors.result
|
||||||
200
|
.map { error =>
|
||||||
|
printError(error)
|
||||||
|
error match {
|
||||||
|
case _: Error.InternalError => 201
|
||||||
|
case _ => 200
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.max()
|
||||||
} else 0
|
} else 0
|
||||||
case Failure(msg) =>
|
case Failure(msg) =>
|
||||||
println(msg)
|
println(msg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user