title: How to handle 'Possibly unhandled rejection: backdrop click' in a general way
body: <p>I have an angular service for handling modals:</p>
  
  <pre><code>angular.module('myApp').service('ModalService', function($uibModal) {
    function open(options) {
      return $uibModal.open(options);
    }
  });
  </code></pre>
  
  <p>Now I upgraded to angular 1.6 and got this error:</p>
  
  <blockquote>
    <p>Possibly unhandled rejection: backdrop click</p>
  </blockquote>
  
  <p>whenever I open a modal and click somewhere else (the backdrop) and the modal closes (as intended). So I want to handle this <code>unhandled exception</code> in my <code>ModalService</code> as I do not want to handle this case everytime I use the <code>ModalService</code>. It is always ok to close the modal via backdrop click, this is no exception.</p>
  
  <p>I tried:</p>
  
  <pre><code>angular.module('myApp').service('ModalService', function($uibModal) {
    function open(options) {
      var modalInstance = $uibModal.open(options);
      modalInstance.result.catch(function error(error) {
        if(error === "backdrop click") {
          // do nothing
        } else {
          throw error;
        }
      })
      return modalInstance;
    }
  });
  </code></pre>
  
  <p>But this leads to the problem that I cannot handle other errors than <code>backdrop click</code> as they are always thrown:</p>
  
  <pre><code>ModalService.open({...}).result.catch(function(error) {
    // this will catch the error too, but the throw in the ModalService
    // will occure in parallel and will not be catched by this function
  });
  </code></pre>
  
  <p>And if I try it like this:</p>
  
  <pre><code>angular.module('myApp').service('ModalService', function($uibModal) {
    function open(options) {
      var modalInstance = $uibModal.open(options);
      modalInstance.result.then(function(whatever) {
        return whatever;
      }, function rejection(error) {
        return error;
      });
      return modalInstance;
    });
  });
  </code></pre>
  
  <p>it resolves the 'unhandled rejection' error, but for every case not just for 'backdrop clicked'.</p>
  
  <p>Has anybody a good solution for this case?</p>