title: Custom Exception Handling in Java
body: <pre><code>final class DBGlobalsException extends Exception
  {
     String mistake;
  
     //where this is shorthand for chained constructors that look like Exception
     DBGlobalsException(String message, Throwable cause)
     {
       super(message,cause);
     }
  
     // elaborate your exception with whatever error state you want to propagate outwards
     void setField(mistake) {  
  
     }
  } 
  
  catch (IOException ex) {
     DBGlobals.Error("OHMjson.Graph.saveLastGraphName - Error: " + ex.getMessage());
     msg = "Unable to save data";
     status = false;
     DBGlobalsException dbe = new DBGlobalsException(msg,ex);
     dbe.setField(status);
     throw dbe;
  }
  </code></pre>
  
  <p>This post code is taken from my previous post... </p>
  
  <p><a href="https://stackoverflow.com/users/recent/454848">https://stackoverflow.com/users/recent/454848</a></p>
  
  <p>Please correct me if i am wrong...</p>
  
  <ol>
  <li>What does the setField method do? Do we need one.</li>
  <li>throw dbe would throw me the expection and the message being appended.</li>
  <li>What does chained construtor mean, is it like having multiple constructors.</li>
  </ol>