title: How to throw custom exception in AngularJS?
body: <p>I have a <code>exception.js</code> script with the following service:</p>
  
  <pre><code>app.service('Exception', function() {
  this.ArgumentUndefinedException = function (message) {
      if (!message) {
          message = "One or more of the arguments are undefined!";
      }
      return {
          name: 'ArgumentUndefinedException',
          message: message
      };
    }
  });
  </code></pre>
  
  <p>Now I use this in another service:</p>
  
  <pre><code>app.service('Joins', ['Exception', function(Exception) {
  this.LEFTJOIN = function(leftArray, rightArray, joinOnLeft, joinOnRight, columnFromRightArray) {
      if (!leftArray) {
          throw new Exception.ArgumentUndefinedException("Left Array is not defined for LEFTJOIN!");
      } else if (!rightArray) {
          throw new Exception.ArgumentUndefinedException("Right Array is not defined for LEFTJOIN!");
      } else if (!joinOnLeft) {
          throw new Exception.ArgumentUndefinedException("Join On Left is not defined for LEFTJOIN!");
      } else {    
        // code to do the left join.
      }
      }
  }])
  </code></pre>
  
  <p>Then when I use the <code>Joins</code> service in a controller without defining the required arguments, my custom exceptions are not thrown. I do not see any other error message in the console. It simply doesn't show anything in the table. What am I doing wrong or is there a better way to throw custom exceptions in Angular? </p>