Log Throwables that happened during the build to the outErr of the BlazeCommandDispatcher. This way they can be logged in the BEP.
PiperOrigin-RevId: 213998158
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java
index 99bbd81..9bc6c4a 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java
@@ -491,6 +491,9 @@
}
return result;
} catch (Throwable e) {
+ outErr.printErr(
+ "Internal error thrown during build. Printing stack trace: "
+ + Throwables.getStackTraceAsString(e));
e.printStackTrace();
BugReport.printBug(outErr, e);
BugReport.sendBugReport(e, args, env.getCrashData());