title: How to handle a long list of Exceptions in java
body: <p>I have a webserver that catches a long list of exceptions when serving a request.</p>
  
  <p>Currently we have a long list of exceptions we deal with with many catch blocks.</p>
  
  <p>Is there a best practice for handling something like this?</p>
  
  <p>I'm thinking of something like </p>
  
  <pre><code>} catch (Exception e) {
     return handleException(e);
  }
  
  Response handleException(Exception e) {
      if (e instanceof DomainException) {
         //DO SOMETHING
      } else if (e instanceof NullPointerException) {
           .
           .
           .
  </code></pre>
  
  <p>I'm not sure if this is any cleaner though. Any suggestions on a better way to handle them?</p>