From 508fc1b5ec0df20e57bfcc23e22d54c3c79e2d0b Mon Sep 17 00:00:00 2001 From: David Perez Date: Thu, 12 Mar 2015 15:30:43 +0100 Subject: [PATCH] Issue 1900, more robustness in help system --- main/command/src/main/scala/sbt/BasicCommands.scala | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/main/command/src/main/scala/sbt/BasicCommands.scala b/main/command/src/main/scala/sbt/BasicCommands.scala index 3310158b8..36072ecc6 100644 --- a/main/command/src/main/scala/sbt/BasicCommands.scala +++ b/main/command/src/main/scala/sbt/BasicCommands.scala @@ -27,7 +27,10 @@ object BasicCommands { def helpParser(s: State) = { - val h = (Help.empty /: s.definedCommands)(_ ++ _.help(s)) + val h = (Help.empty /: s.definedCommands) { (a, b) ⇒ + a ++ + (try b.help(s) catch { case ex: Throwable ⇒ Help.empty }) + } val helpCommands = h.detail.keySet val spacedArg = singleArgument(helpCommands).? applyEffect(spacedArg)(runHelp(s, h)) @@ -35,7 +38,12 @@ object BasicCommands { def runHelp(s: State, h: Help)(arg: Option[String]): State = { - val message = Help.message(h, arg) + val message = try + Help.message(h, arg) + catch { + case ex: Throwable ⇒ + ex.toString + } System.out.println(message) s }