title: Throw exception in optional in Java8
body: <p>There is a method <code>get(sql)</code> (I can not modify it). This method returns MyObjects and it has to be in try catch block because <code>JqlParseException</code> is possible there. My code is:</p>
  
  <pre><code>String sql = something;
  try{
     MyObject object = get(sql);
  } catch(JqlParseException e){
     e.printStackTrace();
  } catch(RuntimeException e){
     e.printStackTrace();
  }
  </code></pre>
  
  <p>I want to remove try catch and use <code>Optional</code> class, I tried:</p>
  
  <pre><code>MyObject object = Optional.ofNullable(get(sql)).orElseThrow(RuntimeException::new);
  </code></pre>
  
  <p>but IDE force there try catch too.
   And for:</p>
  
  <pre><code>MyObject object = Optional.ofNullable(get(sql)).orElseThrow(JqlParseException::new));
  </code></pre>
  
  <p>is an error (in IDE) <code>The type JqlParseException does not define JqlParseException() that is applicable</code>. Is there any way to avoid try catch blocks and use optional?</p>