From 6c123f22ba5da61079de3367a4f28a0028511a7d Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Wed, 8 Jul 2015 10:40:15 +0200 Subject: [PATCH] Hide stacktrace on compilation error in build definition --- main/src/main/scala/sbt/Main.scala | 12 +++++++++++- notes/0.13.10/hide-stacktrace.markdown | 12 ++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 notes/0.13.10/hide-stacktrace.markdown diff --git a/main/src/main/scala/sbt/Main.scala b/main/src/main/scala/sbt/Main.scala index f2fe6ff6b..8c8c9c024 100644 --- a/main/src/main/scala/sbt/Main.scala +++ b/main/src/main/scala/sbt/Main.scala @@ -478,7 +478,17 @@ object BuiltinCommands { val (s1, base) = Project.loadAction(SessionVar.clear(s0), action) IO.createDirectory(base) val s = if (s1 has Keys.stateCompilerCache) s1 else registerCompilerCache(s1) - val (eval, structure) = Load.defaultLoad(s, base, s.log, Project.inPluginProject(s), Project.extraBuilds(s)) + + val (eval, structure) = + try Load.defaultLoad(s, base, s.log, Project.inPluginProject(s), Project.extraBuilds(s)) + catch { + case ex: compiler.EvalException => + s0.log.debug(ex.getMessage) + ex.getStackTrace map (ste => s"\tat $ste") foreach (s0.log.debug(_)) + ex.setStackTrace(Array.empty) + throw ex + } + val session = Load.initialSession(structure, eval, s0) SessionSettings.checkSession(session, s) Project.setProject(session, structure, s) diff --git a/notes/0.13.10/hide-stacktrace.markdown b/notes/0.13.10/hide-stacktrace.markdown new file mode 100644 index 000000000..6a1c49c6d --- /dev/null +++ b/notes/0.13.10/hide-stacktrace.markdown @@ -0,0 +1,12 @@ + + [@Duhemm]: http://github.com/Duhemm + [2071]: https://github.com/sbt/sbt/issues/2071 + [2091]: https://github.com/sbt/sbt/pull/2091 + +### Fixes with compatibility implications + +### Improvements + +- Hide the stack trace on compilation error in build definition [#2071][2071]/[#2091][2091] by [@Duhemm][@Duhemm] + +### Bug fixes