title: How to test if exception is thrown in AngularJS
body: <p>I need to test a directive, and it should throw an exception. How can I test that the exception was thrown, in jasmine?</p>
  
  <p>The directives link function: 
  </p>
  
  <pre><code>link: function() {
      if(something) {
          throw new TypeError('Error message');
      }
  }
  </code></pre>
  
  <p>I have not yet successfully implemented a test that actually catches the error and reports that the test was successful.</p>