Skip to content
Snippets Groups Projects
Commit 7bcd4243 authored by Régis Blanc's avatar Régis Blanc
Browse files

use LeonFatalError to exit

parent 8d704341
Branches
Tags
No related merge requests found
package leon
case class LeonFatalError() extends Exception
...@@ -157,7 +157,11 @@ object Main { ...@@ -157,7 +157,11 @@ object Main {
// Compute leon pipeline // Compute leon pipeline
val pipeline = computePipeline(ctx.settings) val pipeline = computePipeline(ctx.settings)
// Run pipeline try {
pipeline.run(ctx)(args.toList) // Run pipeline
pipeline.run(ctx)(args.toList)
} catch {
case LeonFatalError() => sys.exit(1)
}
} }
} }
...@@ -53,7 +53,7 @@ class DefaultReporter extends Reporter { ...@@ -53,7 +53,7 @@ class DefaultReporter extends Reporter {
def errorFunction(msg: Any) = output(reline(errorPfx, msg.toString)) def errorFunction(msg: Any) = output(reline(errorPfx, msg.toString))
def warningFunction(msg: Any) = output(reline(warningPfx, msg.toString)) def warningFunction(msg: Any) = output(reline(warningPfx, msg.toString))
def infoFunction(msg: Any) = output(reline(infoPfx, msg.toString)) def infoFunction(msg: Any) = output(reline(infoPfx, msg.toString))
def fatalErrorFunction(msg: Any) = { output(reline(fatalPfx, msg.toString)); sys.exit(0) } def fatalErrorFunction(msg: Any) = { output(reline(fatalPfx, msg.toString)); throw LeonFatalError() }
} }
class QuietReporter extends DefaultReporter { class QuietReporter extends DefaultReporter {
......
...@@ -24,7 +24,7 @@ class AnalysisComponent(val global: Global, val pluginInstance: LeonPlugin) ...@@ -24,7 +24,7 @@ class AnalysisComponent(val global: Global, val pluginInstance: LeonPlugin)
protected def stopIfErrors: Unit = { protected def stopIfErrors: Unit = {
if(reporter.hasErrors) { if(reporter.hasErrors) {
sys.exit(1) throw LeonFatalError()
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment