title: AngularJS: Exclusive error handling in $q execution chain
body: <p>Having an angular service that returns promise, is it possible to detect whether a consumer of this promise handles error ?  I'd like to provide a default error handling in service, but ensure that it would be used only if no error handler is defined down the execution chain.</p>
  
  <p>The service method looks like this:</p>
  
  <pre><code>function serviceMethod(method, url, data)
  {
      return $http({
          method: method,
          url: url,
          data: data
      })
      .then(
          function (response) {
              return response;
          },
          function (response) {
              console.log('ERROR!'); // default error handling
          }
      );
  }
  </code></pre>
  
  <p>The <code>serviceMethod</code> returns a promise, therefore:</p>
  
  <p>1) If the consumer provides error handler, the error should be handled exclusively by it.</p>
  
  <pre><code>$scope.getResponse = function () {
      return Services.serviceMethod('put', $scope.url, $scope.someData)
      .then(function (response) {
  
      }, function (error) {
          // Custom error handling.
      });
  }
  </code></pre>
  
  <p>2) If the consumer doesn't provide handler, the error should be handled exclusively by service handler.</p>
  
  <p>Is it possible to achieve in the first successor of <code>serviceMethod</code>? Is it possible at any point in the chain (the error is handled exclusively by the first consumer to provide error handler)?</p>