diff --git a/main/command/src/main/scala/sbt/BasicCommands.scala b/main/command/src/main/scala/sbt/BasicCommands.scala index 3310158b8..caab8ea5c 100644 --- a/main/command/src/main/scala/sbt/BasicCommands.scala +++ b/main/command/src/main/scala/sbt/BasicCommands.scala @@ -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 @@ -27,7 +29,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 NonFatal(ex) => Help.empty }) + } val helpCommands = h.detail.keySet val spacedArg = singleArgument(helpCommands).? applyEffect(spacedArg)(runHelp(s, h)) @@ -35,7 +40,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 NonFatal(ex) => + ex.toString + } System.out.println(message) s } diff --git a/notes/0.13.9/help.markdown b/notes/0.13.9/help.markdown new file mode 100644 index 000000000..dd4d875be --- /dev/null +++ b/notes/0.13.9/help.markdown @@ -0,0 +1,16 @@ + [@cunei]: https://github.com/cunei + [@eed3si9n]: https://github.com/eed3si9n + [@gkossakowski]: https://github.com/gkossakowski + [@jsuereth]: https://github.com/jsuereth + [@DavidPerezIngeniero]: https://github.com/DavidPerezIngeniero + + [1900]: https://github.com/sbt/sbt/issues/1900 + [1940]: https://github.com/sbt/sbt/pull/1940 + +### Changes with compatibility implications + +### Improvements + +### Fixes + +- Captures errors on `help` command. [#1900][1900]/[#1940][1940] by [@DavidPerezIngeniero][@DavidPerezIngeniero]