title: Webpack plugin: Catch errors in build process
body: <p>I'm trying to write a plugin that hooks into various webpack events.. I can't get the plugin to hook into the failed-module event. build-module and succeed-module work fine.</p>
  
  <p>Basically I want to catch any errors that occur during the build process and report them to some external thing. (I'm writing a plugin that emits some signals to an external process when webpack compile process starts, ends or raises errors).</p>
  
  <pre class="lang-js prettyprint-override"><code>Plugin.prototype.apply = function(compiler) {
      var self = this;
  
      compiler.plugin('compilation', function(compilation, callback) {
  
        compilation.plugin('build-module', function(){
          self.shout('build module');
        });
  
        compilation.plugin('succeed-module', function(){
          self.shout('succeed module');
        });
  
        compilation.plugin('failed-module', function(){
          self.shout('failed module');
        });
      });
  
      compiler.plugin('compile', function(compiler, callback) {
        self.shout('started');
      });
  
      compiler.plugin('emit', function(compiler, callback) {
        self.shout('done');
        callback();
      });
  };
  </code></pre>
  
  <p>All but failed-module hooks work. To test, I add a syntax or import error to one of my js files. webpack reports the error on console but the hook is never called. Every other hook but failed-module is called as expected. How do I catch errors in the build process?</p>