title: Java custom exception class usage
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3203297/throws-or-try-catch">Throws or try-catch</a>  </p>
  </blockquote>
  
  
  
  <p>I'm writing an API and I wish to write code such that I can raise an exception in a particular scenario. I've created an exception class as follows :-</p>
  
  <pre><code>public class InvalidSeverityException extends Exception {
      private static final long serialVersionUID = 1L;
      public InvalidSeverityException() {
          // TODO Auto-generated constructor stub
      }
  }
  </code></pre>
  
  <p>In the codebase im having the following to call the code :-</p>
  
  <pre><code>throw new InvalidSeverityException();
  </code></pre>
  
  <p>However Eclipse suggests that I either use <code>throws</code> or enclose it within a <code>try ... catch</code> block. I feel that I shouldn't be catching this error and that the developers who use my API should enclose the code within <code>try...catch</code>.</p>
  
  <p>Does that make sense? Am I doing something wrong?</p>