@@ -109,6 +109,8 @@ public final class DevModeHandler implements RequestHandler {
109
109
110
110
private boolean notified = false ;
111
111
112
+ private StringBuilder cumulativeOutput = new StringBuilder ();
113
+
112
114
private volatile String failedOutput ;
113
115
114
116
private AtomicBoolean isDevServerFailedToStart = new AtomicBoolean ();
@@ -469,6 +471,9 @@ private void readLinesLoop(Pattern success, Pattern failure,
469
471
output .append (cleanLine ).append (System .lineSeparator ());
470
472
}
471
473
474
+ // save output so as it can be used to log exception if run fails
475
+ cumulativeOutput .append (cleanLine ).append (System .lineSeparator ());
476
+
472
477
boolean succeed = success .matcher (line ).find ();
473
478
boolean failed = failure .matcher (line ).find ();
474
479
// We found the success or failure pattern in stream
@@ -478,6 +483,7 @@ private void readLinesLoop(Pattern success, Pattern failure,
478
483
failedOutput = failed ? output .toString () : null ;
479
484
// reset output and logger for the next compilation
480
485
output = getOutputBuilder ();
486
+ cumulativeOutput = new StringBuilder ();
481
487
log = info ;
482
488
// Notify DevModeHandler to continue
483
489
doNotify ();
@@ -654,6 +660,9 @@ private boolean doStartWebpack(DeploymentConfiguration config,
654
660
}
655
661
656
662
if (!webpackProcess .get ().isAlive ()) {
663
+ getLogger ().error (
664
+ String .format ("Webpack failed with the exception:%n%s" ,
665
+ cumulativeOutput .toString ()));
657
666
throw new IllegalStateException ("Webpack exited prematurely" );
658
667
}
659
668
0 commit comments