title: Java throwing exceptions inside try block
body: <p>I have a code which looks like this:</p>
  
  <pre><code>try {
      if (resp.equals("a")) {
         success(resp);
     } else if (resp.equals("b")) {
         throw new Exception("b error");
     } else if (resp.equals("c")) {
         throw new Exception("c error");
     }
  
  } catch (Exception e) {
      dosomething(e.getMessage());
  }
  </code></pre>
  
  <p>My catch statement doesn't catch the error... I'm I doing something wrong when I throw the exception that gets outside the try block?</p>