Catch exceptions with NonFatal

This commit is contained in:
David Perez 2015-03-25 15:02:45 +01:00
parent 2c52efeca5
commit 5ce11c67c5
1 changed files with 4 additions and 2 deletions

View File

@ -13,6 +13,8 @@ import BasicKeys._
import java.io.File
import scala.util.control.NonFatal
object BasicCommands {
lazy val allBasicCommands = Seq(nop, ignore, help, completionsCommand, multi, ifLast, append, setOnFailure, clearOnFailure, stashOnFailure, popOnFailure, reboot, call, early, exit, continuous, history, shell, read, alias) ++ compatCommands
@ -29,7 +31,7 @@ object BasicCommands {
{
val h = (Help.empty /: s.definedCommands) { (a, b) =>
a ++
(try b.help(s) catch { case ex: Throwable => Help.empty })
(try b.help(s) catch { case NonFatal(ex) => Help.empty })
}
val helpCommands = h.detail.keySet
val spacedArg = singleArgument(helpCommands).?
@ -41,7 +43,7 @@ object BasicCommands {
val message = try
Help.message(h, arg)
catch {
case ex: Throwable =>
case NonFatal(ex) =>
ex.toString
}
System.out.println(message)